from functools import lru_cache N=int(input()) S=[list(map(int,input().split())) for i in range(N)] @lru_cache(maxsize=None) def solve(idx): retu=[0]*N if len(idx)==1: retu[idx[0]]=1 else: le=len(idx) for bit in range(1<