def recuringSolve(data, currentSol):
    # print('==============')
    # print(data)
    # print(currentSol)
    if len(data) == 0:
        if checkSolution(currentSol):
            displaySolution(currentSol)
        return

    row = data.pop(0)
    for i in range(4):
        # print(i)
        currentSol.append(row)
        recuringSolve(data, currentSol)
        currentSol.pop()
        row = rotate(row)
    data.insert(0, row)
def recuringSolve(data, currentSol):
    # print('==============')
    # print(data)
    # print(currentSol)
    if len(data) == 0:
        if checkSolution(currentSol):
            displaySolution(currentSol)
        return

    row = data.pop(0)
    for i in range(4):
        # print(i)
        currentSol.append(row)
        recuringSolve(data, currentSol)
        currentSol.pop()
        row = rotate(row)
    data.insert(0, row)
def solve(data):
    currentSol = [data.pop(0)]
    recuringSolve(data, currentSol)
def solve(data):
    currentSol = [data.pop(0)]
    recuringSolve(data, currentSol)