| Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
 
 
 Confusion Matrix  In artificial intelligence, especially in supervised 
learning, performance of an algorithm is measured using 
a specific table layout which is called Confusion matrix. 
On the rows of the table actual object classes are listed. 
And on the  columns the predicted object classes are listed. 
For example the table below lists confusion matrix for 
positive and negative objects. 
The table on the right tells that there are actually 8 
positive and 6 negative objects. The algorithm has predicted 
5 positives and 4 negatives correctly. But it has predicted 
3 positives as negative and 2 negatives as positive. 
 
Question:
Write a program that is going to read actual and predicted 
classes of n objects. Then your program will  show the 
confusion matrix.
 
Input specification  You will be given two integers in the beginning: 
the number of classes (k) and the number of 
queries (n). Then in the following k lines,
you will be k strings (which are in alphabetical 
order): the object classes where
each class label can have at most 20 chars (only
26 English letters). The in the following n lines
you will be given two strings.
 
where 1 ≤ n ≤ 5,000 and 
1 ≤ k ≤ 60.Actual object classDetected class Output specification  Show k-by-k matrix.
    
| Sample Input I 
 
3 10Apple
 Orange
 Pear
 Pear Pear
 Orange Orange
 Apple Orange
 Orange Orange
 Pear Pear
 Pear Pear
 Orange Pear
 Apple Apple
 Orange Orange
 Apple Pear
 
 | Sample Output I 
 
1 1 10 3 1
 0 0 3
 
 |  
 Для отправки решений необходимо выполнить вход.
 
 
 |