package main import ( "fmt" ) func main() { list := [10]bool{true, true, true, true, true, true, true, true, true, true} var n int fmt.Scan(&n) for i := 0; i < n; i++ { var a, b, c, d int var r string fmt.Scan(&a, &b, &c, &d, &r) if r == "YES" { for x := 0; x < 10; x++ { if list[x] == true && x != a && x != b && x != c && x != d { list[x] = false } } } else { for x := 0; x < 10; x++ { if list[x] == true && (x == a || x == b || x == c || x == d) { list[x] = false } } } } for x := 0; x < 10; x++ { if list[x] == true { fmt.Println(x) } } }