N = int(input()) uw = [list(map(int, input().split())) for _ in range(N)] uw.sort() if uw[i][0] == 1: print("Yes") exit() if uw[i][0] != 2: print("No") exit() print("No") exit() w2 = [] w3 = [] for u, w in uw: if u == 2: w2.append(w) elif u == 3: w3.append(w) w2.sort() w3.sort()