def ExtractAssignment(U, model):
    """
    Extracts assignment in permutations given a model from pysat
    """
    n = len(U)
    k = len(U[0])

    # Function to translate any glucose number into it's
    # corresponding x_{ij}
    def xi(g):
        g = g - 1
        i = g // n
        j = g - (i * n)
        return (i, j)

    # Function to translate any glucose number into it's
    # corresponding y_{ij}
    def yi(g):
        g = g - 1
        i = (g - (n * n)) // n
        j = g - (n * n) - (i * n)
        return (i, j)

    p = [-1 for x in range(n)]
    s = [-1 for x in range(n)]
    for m in model:
        if m > 0 and m <= (n * n):
            i, j = xi(m)
            p[j] = i
        elif m > 0 and m > (n * n):
            i, j = yi(m)
            s[j] = i
    return p, s