ys, ms, ds = map(int, input().split()) ye, me, de = map(int, input().split()) Q = int(input()) query = [list(map(int, input().split())) for _ in range(Q)] def is_leap(year): return year%4 == 0 and not (year%100 == 0 and year%400 != 0) def day_count(year, month): if month == 2: if is_leap(year): return 29 else: return 28 elif month in [4, 6, 9, 11]: return 30 else: return 31 def range_count(ys, ms, ds, ye, me, de): if (ys, ms) == (ye, me): return de-ds+1 if ys == ye: ans = 1-ds for month in range(ms, me): ans += day_count(ys, month) ans += de return ans ans = 1-ds for month in range(ms, 13): ans += day_count(ys, month) for year in range(ys+1, ye): if is_leap(year): ans += 366 else: ans += 365 for month in range(1, me): ans += day_count(ye, month) ans += de return ans first_count = range_count(ys, ms, ds, ye, me, de) for y, m, d in query: second_count = range_count(ye, me, de, y, m, d)-1 if second_count < first_count: print("Less") elif second_count == first_count: print("Same") else: print("More")