Diaa does SMS


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 256M

Problem types

We all know Diaa as a MACS member, but very few people know that his initial professional profile is as a telecom engineer. Diaa had a critical task in the past to generate a complete list of verbose information about a set of problematic subscribers on the SMS solution.

As lazy as he is, he asked 2 of his colleagues to give him the data, unfortunately, none of the provided data was complete, one set of data contains only the MSIDN and the IMSI , and the other contains only the IMSI and the region.

Your task is to generate one list of the 3 pieces of data correctly mapped.

Input Specification

The first line of the input contains an integer \(0 \leq N \leq 100\) indicating the total number of lines in the first list.

Followed by a \(N\) lines, each line contains 2 Strings separated by a comma: MSISDN,IMSI

MSISDN is a String starting with '+' and followed by \(12\) digits.

IMSI is a String composed of \(14\) digits.

After this list you will find a line containing one integer \(1 \leq M \leq 100\), indicating the total number of lines of the second list, followed by M lines.

Each line is composed of \(2\) Strings separated by a comma: Region,MSISDN

Region is a String composed of Alphabet characters, and MSISDN has the same form as in the first list.

Output Specification

For each MSISDN print one line with the 3 information:

MSISDN,IMSI,region

Sorted Alphabetically by MSIDN then IMSI and by region.

Sample Input

5
+212661080808,604011234567890
+212661080899,604011234567855
+212661080811,604011234567443
+212661082208,604011234561234
+212661120808,604011234567444
3
Tangiers,+212661080808
Rabat,+212661080811
Taza,+212661080812

Sample Output

+212661080808,604011234567890,Tangiers
+212661080811,604011234567443,Rabat

Notes

If you cannot find a correct mapping for a MSISDN, you should ignore it from the final output.

If no mappings could be found print \("no match"\) without quotes.


Comments

There are no comments at the moment.