package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())
	m := map[string]int{
		"0": 0,
		"1": 0,
		"2": 0,
		"3": 0,
		"4": 0,
		"5": 0,
		"6": 0,
		"7": 0,
		"8": 0,
		"9": 0,
	}
	for i := 0; i < N; i++ {
		sc.Scan()
		strs := strings.Split(sc.Text(), " ")
		if strs[4] == "YES" {
			for j := 0; j < 4; j++ {
				m[strs[j]]++
			}
		} else {
			for j := 0; j < 4; j++ {
				m[strs[j]]--
			}
		}
	}
	max := m["0"]
	ans := "0"
	for k, v := range m {
		if v > max {
			max = v
			ans = k
		}
	}
	fmt.Println(ans)
}