b,e=dict(),dict() mx=0 for _ in range(int(input())): a,b,c=list(map(int,input().split())) b[a]=c;e[b]=c #cause of erro