import sys readline = sys.stdin.readline # DEBUG = True DEBUG = False class Interactive: def __init__(self): self.ques_cnt = 0 self.create_data() def create_data(self): import random x = random.randint(0,999) pwd = '{:03}'.format(x) print('created pwd:', pwd) self.pwd = pwd def resp_ques(self, *args): if args == (self.pwd,): return 'unlocked' else: return 'locked' def resp_ans(self, *args): pass if DEBUG: interactive = Interactive() def question(*args, offset=None): if offset is None: print(*args, flush=True) else: print(offset, *args, flush=True) if DEBUG: resp = interactive.resp_ques(*args) print(resp) return resp else: return readline() def answer(*args, offset=None): if offset is None: print(*args, flush=True) else: print(offset, *args, flush=True) if DEBUG: interactive.resp_ans(*args) else: exit() for x in range(1000): ques = '{:03}'.format(x) resp = question(ques) if resp == 'unlocked': break