def ms():
    graph = {
        'A':['B','C'],
        'B':['D','E'],
        'C':['F','G'],
        'D':['H','I'],
        'E':['J','K'],
        'F':['L','M'],
        'G':['N','O'],
        'H':[],
        'I':[],
        'J':[],
        'K':[],
        'L':[],
        'M':[],
        'N':[],
        'O':[]
    }

    def MA(start,goal,path,level,maxD):
        print('\nCurrent level-->',level)
        print('Goal node testing for',start)
        path.append(start)
        if start == goal:
            print("Goal test successful")
            return path
        print('Goal node testing failed')
        if level==maxD:
            return False
        print('\nExpanding the current node',start)
        for child in graph[start]:
            if MA(child,goal,path,level+1,maxD):
                return path
            path.pop()
        return False
    


    start = 'A'
    goal = input('Enter the goal node:-')
    maxD = int(input("Enter the maximum depth limit:-"))
    print()
    path = list()
    res = MA(start,goal,path,0,maxD)
    if(res):
        print("Path to goal node available")
        print("Path",path)
    else:
        print("No path available for the goal node in given depth limit")
def msop():
        print('''graph = {
        'A':['B','C'],
        'B':['D','E'],
        'C':['F','G'],
        'D':['H','I'],
        'E':['J','K'],
        'F':['L','M'],
        'G':['N','O'],
        'H':[],
        'I':[],
        'J':[],
        'K':[],
        'L':[],
        'M':[],
        'N':[],
        'O':[]
    }

def MA(start,goal,path,level,maxD):
        print('\nCurrent level-->',level)
        print('Goal node testing for',start)
        path.append(start)
        if start == goal:
            print("Goal test successful")
            return path
        print('Goal node testing failed')
        if level==maxD:
            return False
        print('\nExpanding the current node',start)
        for child in graph[start]:
            if MA(child,goal,path,level+1,maxD):
                return path
            path.pop()
        return False
    


start = 'A'
goal = input('Enter the goal node:-')
maxD = int(input("Enter the maximum depth limit:-"))
print()
path = list()
res = MA(start,goal,path,0,maxD)
if(res):
        print("Path to goal node available")
        print("Path",path)
else:
        print("No path available for the goal node in given depth limit") ''')