def main():
    site_pins = json5.load(sys.stdin)

    output_site_pins = {}
    output_site_pins["tile_type"] = site_pins["tile_type"]
    output_site_pins["sites"] = copy.deepcopy(site_pins["sites"])

    site_pin_to_wires = create_site_pin_to_wire_maps(site_pins['tile_name'],
                                                     site_pins['nodes'])
    min_x_coord, min_y_coord = find_origin_coordinate(site_pins['sites'])

    for site in output_site_pins['sites']:
        orig_site_name = site['name']
        coordinate = SITE_COORDINATE_PATTERN.match(orig_site_name)

        x_coord = int(coordinate.group(2))
        y_coord = int(coordinate.group(3))
        site['name'] = 'X{}Y{}'.format(x_coord - min_x_coord,
                                       y_coord - min_y_coord)
        site['prefix'] = coordinate.group(1)
        site['x_coord'] = x_coord - min_x_coord
        site['y_coord'] = y_coord - min_y_coord

        for site_pin in site['site_pins']:
            assert site_pin['name'].startswith(orig_site_name + '/')
            if site_pin['name'] in site_pin_to_wires:
                site_pin['wire'] = site_pin_to_wires[site_pin['name']]
            else:
                print(
                    ('***WARNING***: Site pin {} for tile type {} is not connected, '
                     'make sure all instaces of this tile type has this site_pin '
                     'disconnected.').format(site_pin['name'],
                                             site_pins['tile_type']),
                    file=sys.stderr)

            site_pin['name'] = site_pin['name'][len(orig_site_name) + 1:]

    json.dumps(output_site_pins, indent=2, sort_keys=True)