import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args) throws Exception{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
        int can_num=Integer.parseInt(br.readLine());
        String[] cans=br.readLine().split(" ");
        int count_num=Integer.parseInt(br.readLine());
        String[] counts=br.readLine().split(" ");
        Map<String,Integer> hmap=new LinkedHashMap<>();
        for(String can:cans){
            hmap.put(can,0);
        }
        
        String no="Invalid";
        hmap.put(no,0);
        for(String count:counts){
            if(hmap.containsKey(count)){
                hmap.put(count,hmap.get(count) +1);
            }
            else {
                hmap.put(no,hmap.getOrDefault(no,0)+1);
            }
        }
        for(Map.Entry<String,Integer> entry:hmap.entrySet()){
            out.println(entry.getKey()+" : "+entry.getValue());
            out.flush();
        }
    }
}