package main import "fmt" import "reflect" func log(items... interface{}) { fmt.Println(items...) } func bug(items... interface{}) { panic("bug " + fmt.Sprint(items...)) } func assert(condition bool, items... interface{}) { if !condition { panic("assertion failed: " + fmt.Sprint(items...)) } } func scanln(args... interface{}) { nargs := make([]interface{}, 0, len(args)) for _, arg := range args { switch reflect.TypeOf(arg).Kind() { case reflect.Slice: v := reflect.ValueOf(arg) n := v.Len() for i := 0; i < n; i++ { nargs = append(nargs, v.Index(i).Addr().Interface()) } default: nargs = append(nargs, arg) } } n, e := fmt.Scanln(nargs...) if e != nil { panic(e) } assert(n == len(nargs)) } func check(n, low, high int) { if n < low || n > high { bug("bad input: ", n, " not in range ", low, " to ", high) } } func main() { var N int scanln(&N) check(N, 2, 10) var x0, y0 int scanln(&x0, &y0) vert := true hor := true for n := 1; n < N; n++ { var x, y int scanln(&x, &y) if x != x0 { vert = false } if y != y0 { hor = false } } if vert || hor { fmt.Println("YES") } else { fmt.Println("NO") } }