def map_JW_to_rcs(nh, nv, site):
    """Mapping Jordan-Wigner encoding to (row, column, spin-type).

    Args:
        nhoriz -- number of horizontal sites
        nvert -- number of vertical sites
        site -- qubit in jordan-wigner string

    Returns:
        Tuple with qubit (row, column and spin-type)
    """
    row = site // nh
    if (row%2 == 0):
        col = site % nh
    else:
        col = nh - (site % nh) - 1
    spin = 0
    if row > nv:
        row = row - nv
        spin = 1
    return (row, col, spin)