from typing import Iterable
from typing import Tuple
from typing import Sequence


def split_on_common_bit(
    inp: Iterable[str], bit_idx: int
) -> Tuple[Sequence[str], Sequence[str]]:
    """
    Splits `inp` in two lists, based on the most and least common bit at `bit_idx`.
    Returns:
        (most_common, least_common)
    """
    ones = []
    zeroes = []

    for bitline in inp:
        if bitline[bit_idx] == "0":
            zeroes.append(bitline)
        elif bitline[bit_idx] == "1":
            ones.append(bitline)

    if len(ones) > len(zeroes):
        return (ones, zeroes)
    elif len(zeroes) > len(ones):
        return (zeroes, ones)
    else:
        return (ones, zeroes)