from lower_bound_online import W,H,next_L,print_state

init_state = [7,7,7,7,7,7]

def interact():
    state = init_state
    while sum(state) != 0:
        print_state(state)
        c,r = list(map(int,input().split(" ")))
        state = next_L(state,c,r)
    print("-----------END-----------")

if __name__ == "__main__":
    interact()