import sys input = sys.stdin.readline from datetime import datetime ys,ms,ds=map(int,input().split()) ye,me,de=map(int,input().split()) X=datetime(ys,ms,ds) Y=datetime(ye,me,de) Q=int(input()) for tests in range(Q): y,m,d=map(int,input().split()) Z=datetime(y,m,d) A=Y-X B=Z-Y if A.days+1==B.days: print("Same") elif A.days+1>B.days: print("Less") else: print("More")