def main(): n = int(input()) A = [] B = [] for i in range(n): a, b = map(int, input().split()) A.append(a) B.append(b) INF = 10**18 dp = [[0]*n for i in range(1<>i)&1): continue for j in range(n): if (s>>j)&1: continue ns = s|(1<