def METHOD_NAME():
    state_stack = list()                                                        #maintaining a stack for the states.
    visited_states = set()                                                      #maintaining a set for visited states. (allowing only unique states to consider)
    initial_state = (3, 3, 'left')                                              #initialising our initial state. 
    visited_states.add(initial_state)                                           #visiting the initial state. 
    states = [initial_state]                                                    #maintaining a list of states in consideration at a time.
    all_states = [states]                                                       #maintaining a list of all the states taken in consideration throughout the game. 
    print("Initial state: " + str(initial_state))                               #initialising our initial state. 
    win = False                                                 
    while not win:                                                              #looping over until we win
        print("States: " + str(states))                                         #printing the current states in consideration.
        new_states = []
        for game_state in states:                                               #for every state in the states taken in consideration, checking for goal test condition
            print("Current State: " + str(game_state))
            state_stack.append(game_state)                                         
            if game_state[0] == game_state[1] == 0:   
                print("Win! Last state: " + str(game_state))
                win = True
                break
            future_states = get_future_states(game_state)                       #if goal not achieved, moving ahead and generating its future states.(children)
            for future_state in future_states:                                  #for every future state generated,
                if future_state not in visited_states:                          #ensuring, we have not visited it before
                    new_states.append(future_state)                             #only then we will consider it as our next state. 
                    visited_states.add(future_state)                            #visiting the state. 
                    print("Future State: " + str(future_state))       
                else:
                    print("Future State: " + str(future_state))       
                    print("We have visited " + str(future_state) +  " state before. let's move back")            
            print()
        if not win:                                                             
            states = new_states
            all_states.append(states)