def decode_bin(num, n):
    """
        Decode an integer into a pair of length-n binary tuples.
    """
    ret = []
    for _ in range(2*n):
        ret.append(num%2)
        num = num // 2
    return tuple(ret[:n]), tuple(ret[n:])