from datetime import * ys, ms, ds = map(int, input().split()) ye, me, de = map(int, input().split()) xs = date(ys, ms, ds) xe = date(ye, me, de) for _ in range(int(input())): y, m, d = map(int, input().split()) x = date(y, m, d) d1 = xe - xs d2 = x - xe print('Less' if d2 < d1 + timedelta(days=1) else 'Same' if d2 == d1 + timedelta(days=1) else 'More')