import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No24{ public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int turn = Integer.parseInt(br.readLine()); kazuate(br, turn); } catch(IOException e){ e.getStackTrace(); } catch(NumberFormatException e){ e.getStackTrace(); } } public static void kazuate(BufferedReader br, int n) throws IOException, NumberFormatException{ int[] jiroThought = new int[10]; int[] taroSuggest = new int[4]; for(int i=0; i < n; i++){ String[] str = br.readLine().split(" "); for(int j=0; j < 4; j++) taroSuggest[j] = Integer.parseInt(str[j]); for(int k=0; k < 4; k++){ if(str[4].equals("YES")) jiroThought[taroSuggest[k]]++; else if (str[4].equals("NO")) jiroThought[taroSuggest[k]]--; } } System.out.println(getIndex(jiroThought)); System.out.println(" "); for(int hako:jiroThought){ System.out.println(hako); } } public static int getIndex(int[] a){ int ans = 0; int max = 0; for(int i=0; i < a.length; i++){ if(max <= a[i]){ max = a[i]; ans = i; } } return ans; } }