def METHOD_NAME(wt, gamma):  # gamma is motivic, max is 1
    """
    Input wt an integer
          gamma a list of integers.
    Output : list of lists of integers
    """
    t = 1
    H = []
    while 2*t > 2-wt:
        m = gamma.count(t)
        n = gamma.count(t-1)
        if n < m:
            raise ValueError('Gamma factors are not Hodge')
        for _ in range(1, m + 1):
            gamma.remove(t)
            gamma.remove(t-1)
            H.append([wt-1+t, 1-t, 2])  # eps is 2 when p!=q
            H.append([1-t, wt-1+t, 2])  # eps is 2 when p!=q
        t = t-1
    if wt % 2 == 0:
        wt2 = wt//2
        e = 1-wt2
        m = gamma.count(e)
        for _ in range(1, m+1):
            gamma.remove(e)
            H.append([wt2, wt2, 1])
        e = -wt2
        m = gamma.count(e)
        for _ in range(1, m+1):
            gamma.remove(e)
            H.append([wt2, wt2, 0])
    if len(gamma) != 0:
        raise ValueError('Gamma factors not Hodge')
    H.sort()
    return H