n=int(input()) F=[list(map(int,input().split())) for i in range(n)] DP=[-1]*(1<