from collections import Counter # 入力 N = int(input()) names = [] all_names = [] for _ in range(N): s, t = input().split() names.append((s, t)) all_names.append(s) all_names.append(t) # 统计所有姓和名的出现次数 count = Counter(all_names) # 对每个人检查:是否有至少一个唯一的(即出现1次的)名字 for s, t in names: if count[s] > 1 and count[t] > 1: print("No") break else: print("Yes")