import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        scanner.useDelimiter("\n");

        while (scanner.hasNextInt()) {
            int ren = scanner.nextInt();

            String[] names = scanner.next().split(" ");
            int tou = scanner.nextInt();
            String[] S = scanner.next().split(" ");

            Map<String, Integer> hashMap = new LinkedHashMap<>();
            for (int i = 0; i < names.length; i++) {
                hashMap.put(names[i], 0);
            }
            hashMap.put("Invalid", 0);
            for (int i = 0; i < S.length; i++) {
                if (!hashMap.containsKey(S[i])) {
                    hashMap.put("Invalid", hashMap.get("Invalid")+1);
                } else {
                    hashMap.put(S[i], hashMap.get(S[i])+1);
                }
            }
            hashMap.entrySet().stream().forEach(o->{
                System.out.println(o.getKey() + " : " + o.getValue());
            });

        }
    }
}