@staticmethod
def combinations(a, r):
    a = tuple(a)
    n = len(a)
    if (r > n):
        return
    indices = list(range(r))
    (yield a[:r])
    while True:
        for i in range((r - 1), (- 1), (- 1)):
            if (indices[i] != ((i + n) - r)):
                break
        else:
            return
        indices[i] += 1
        for j in range((i + 1), r):
            indices[j] = (indices[(j - 1)] + 1)
        (yield tuple((a[i] for i in indices)))
@staticmethod
def combinations(a, r):
    a = tuple(a)
    n = len(a)
    if (r > n):
        return
    indices = list(range(r))
    (yield a[:r])
    while True:
        for i in range((r - 1), (- 1), (- 1)):
            if (indices[i] != ((i + n) - r)):
                break
        else:
            return
        indices[i] += 1
        for j in range((i + 1), r):
            indices[j] = (indices[(j - 1)] + 1)
        (yield tuple((a[i] for i in indices)))