#Image id 0 - cam 4

pa_order_in_json_to_unified_id = dict(zip(range(1, 11), range(48, 58)))
pa_order_in_json_to_unified_id.update(dict(zip(range(11, 19), range(1004, 1012))))

#Image id 1 - cam 1

pa_order_in_json_to_unified_id.update(dict(zip(range(19, 50), range(1, 32))))
pa_order_in_json_to_unified_id.update({50: 1001})

# Image id 2 - cam 2

pa_order_in_json_to_unified_id.update(dict(zip(range(51, 54), range(6, 9))))
pa_order_in_json_to_unified_id.update(dict(zip(range(54, 58), range(13, 17))))
pa_order_in_json_to_unified_id.update(dict(zip(range(58, 66), range(17, 25))))
pa_order_in_json_to_unified_id.update(dict(zip(range(66, 73), range(25, 32))))
pa_order_in_json_to_unified_id.update(dict(zip(range(73, 84), range(32, 43))))
pa_order_in_json_to_unified_id.update(dict(zip(range(84, 87), range(58, 61))))
pa_order_in_json_to_unified_id.update(dict(zip(range(87, 89), range(1001, 1003))))

# Image id 3 - cam 3

pa_order_in_json_to_unified_id.update(dict(zip(range(89, 101), range(41, 53))))
pa_order_in_json_to_unified_id.update(dict(zip(range(101, 106), range(53, 58))))
pa_order_in_json_to_unified_id.update(dict(zip(range(106, 111), range(1003, 1008))))
pa_order_in_json_to_unified_id.update({112: 1008, 111: 1009, 113: 1010})

pa_cam_to_space_id = {"cam_1": list(range(19, 51)),
                      "cam_2": list(range(51, 89)),
                      "cam_3": list(range(89, 114)),
                      "cam_4": list(range(1, 19))}

pa_cam_to_unified_id = {k: list(map(lambda x: pa_order_in_json_to_unified_id[x], v)) for k, v in pa_cam_to_space_id.items()}

pa_unified_id_and_adjacency_ids = {}

for i in range(1, 61):
    if i == 1:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                   "western_adjacency": None,
                                                                   "southern_adjacency": None,
                                                                   "northern_adjacency": i + 8,
                                                                   "south_east_adjacency": None,
                                                                   "south_west_adjacency": None,
                                                                   "north_west_adjacency": None,
                                                                   "north_east_adjacency": i + 9}}})
    elif i in range(2, 8):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 8,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 7,
                                                                    "north_east_adjacency": i + 9}}})
    elif i == 8:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 8,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 7,
                                                                    "north_east_adjacency": None}}})
    elif i == 9:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": i - 8,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 7,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i in range(10, 16):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 8,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 7,
                                                                    "south_west_adjacency": i - 9,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 16:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 8,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": i - 9,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 17:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": i + 8}}})
    elif i in range(18, 24):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 7,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 6,
                                                                    "north_east_adjacency": i + 8}}})
    elif i == 24:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 7,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 6,
                                                                    "north_east_adjacency": None}}})
    elif i == 25:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": i - 7,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 6,
                                                                    "south_west_adjacency": i - 8,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i in range(26, 31):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 7,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 6,
                                                                    "south_west_adjacency": i - 8,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 31:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 7,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": i - 8,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 32:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i in range(33, 52):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 52:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": i + 1}}})
    elif i == 53:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": i - 1,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 54:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 55:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 56:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": i + 1,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 57:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i - 1,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 58:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 59:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 60:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})

#pa_unified_id_and_adjacency_ids = {0: {"adjacencies": {"eastern_adjacency": 1,
#                                                         "western_adjacency": None,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 15,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                       "north_west_adjacency": None,
#                                                       "north_east_adjacency": 14}},
#                                   1: {"adjacencies": {"eastern_adjacency": 2,
#                                                         "western_adjacency": 0,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 14,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 15,
#                                                         "north_east_adjacency": 13}},
#                                   2: {"adjacencies": {"eastern_adjacency": 3,
#                                                         "western_adjacency": 1,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 13,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 14,
#                                                         "north_east_adjacency": 12}},
#                                   3: {"adjacencies": {"eastern_adjacency": 4,
#                                                         "western_adjacency": 2,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 12,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 13,
#                                                         "north_east_adjacency": 11}},
#                                   4: {"adjacencies": {"eastern_adjacency": 5,
#                                                         "western_adjacency": 3,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 11,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 12,
#                                                         "north_east_adjacency": 10}},
#                                   5: {"adjacencies": {"eastern_adjacency": 6,
#                                                         "western_adjacency": 4,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 10,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 11,
#                                                         "north_east_adjacency": 9}},
#                                   6: {"adjacencies": {"eastern_adjacency": 7,
#                                                         "western_adjacency": 5,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 9,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 10,
#                                                         "north_east_adjacency": 8}},
#                                   7: {"adjacencies": {"eastern_adjacency": None,
#                                                         "western_adjacency": 6,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 8,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 9,
#                                                         "north_east_adjacency": None}},
#                                   8: {"adjacencies": {"eastern_adjacency": None,
#                                                         "western_adjacency": 9,
#                                                         "southern_adjacency": 7,
#                                                         "northern_adjacency": None,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": 6,
#                                                         "north_west_adjacency": None,
#                                                         "north_east_adjacency": None}},
#                                   9: {"adjacencies": {"eastern_adjacency": 8,
#                                                         "western_adjacency": 10,
#                                                         "southern_adjacency": 6,
#                                                         "northern_adjacency": None,
#                                                         "south_east_adjacency": 7,
#                                                         "south_west_adjacency": 5,
#                                                         "north_west_adjacency": None,
#                                                         "north_east_adjacency": None}},
#                                   10: {"adjacencies": {"eastern_adjacency": 9,
#                                                          "western_adjacency": 11,
#                                                          "southern_adjacency": 5,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 6,
#                                                          "south_west_adjacency": 4,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   11: {"adjacencies": {"eastern_adjacency": 10,
#                                                          "western_adjacency": 12,
#                                                          "southern_adjacency": 4,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 5,
#                                                          "south_west_adjacency": 3,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   12: {"adjacencies": {"eastern_adjacency": 11,
#                                                          "western_adjacency": 13,
#                                                          "southern_adjacency": 3,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 4,
#                                                          "south_west_adjacency": 2,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   13: {"adjacencies": {"eastern_adjacency": 12,
#                                                          "western_adjacency": 14,
#                                                          "southern_adjacency": 2,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 3,
#                                                          "south_west_adjacency": 1,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   14: {"adjacencies": {"eastern_adjacency": 13,
#                                                          "western_adjacency": 15,
#                                                          "southern_adjacency": 1,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 2,
#                                                          "south_west_adjacency": 0,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   15: {"adjacencies": {"eastern_adjacency": 14,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 0,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 1,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   16: {"adjacencies": {"eastern_adjacency": 17,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 30}},
#                                   17: {"adjacencies": {"eastern_adjacency": 18,
#                                                          "western_adjacency": 16,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 30,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 29}},
#                                   18: {"adjacencies": {"eastern_adjacency": 19,
#                                                          "western_adjacency": 17,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 29,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 30,
#                                                          "north_east_adjacency": 28}},
#                                   19: {"adjacencies": {"eastern_adjacency": 20,
#                                                          "western_adjacency": 18,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 28,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 29,
#                                                          "north_east_adjacency": 27}},
#                                   20: {"adjacencies": {"eastern_adjacency": 21,
#                                                          "western_adjacency": 19,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 27,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 28,
#                                                          "north_east_adjacency": 26}},
#                                   21: {"adjacencies": {"eastern_adjacency": 22,
#                                                          "western_adjacency": 20,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 26,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 27,
#                                                          "north_east_adjacency": 25}},
#                                   22: {"adjacencies": {"eastern_adjacency": 23,
#                                                          "western_adjacency": 21,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 25,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 26,
#                                                          "north_east_adjacency": 24}},
#                                   23: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 22,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 24,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 25,
#                                                          "north_east_adjacency": None}},
#                                   24: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 25,
#                                                          "southern_adjacency": 23,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 22,
#                                                          "north_east_adjacency": None}},
#                                   25: {"adjacencies": {"eastern_adjacency": 24,
#                                                          "western_adjacency": 26,
#                                                          "southern_adjacency": 22,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 23,
#                                                          "south_west_adjacency": 21,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   26: {"adjacencies": {"eastern_adjacency": 25,
#                                                          "western_adjacency": 27,
#                                                          "southern_adjacency": 21,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 22,
#                                                          "south_west_adjacency": 20,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   27: {"adjacencies": {"eastern_adjacency": 26,
#                                                          "western_adjacency": 27,
#                                                          "southern_adjacency": 20,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 21,
#                                                          "south_west_adjacency": 19,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   28: {"adjacencies": {"eastern_adjacency": 27,
#                                                          "western_adjacency": 29,
#                                                          "southern_adjacency": 19,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 20,
#                                                          "south_west_adjacency": 18,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   29: {"adjacencies": {"eastern_adjacency": 28,
#                                                          "western_adjacency": 30,
#                                                          "southern_adjacency": 18,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 19,
#                                                          "south_west_adjacency": 17,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   30: {"adjacencies": {"eastern_adjacency": 29,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 17,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 18,
#                                                          "south_west_adjacency": 16,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   31: {"adjacencies": {"eastern_adjacency": 32,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 72,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 71}},
#                                   32: {"adjacencies": {"eastern_adjacency": 33,
#                                                          "western_adjacency": 31,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 71,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 72,
#                                                          "north_east_adjacency": 70}},
#                                   33: {"adjacencies": {"eastern_adjacency": 34,
#                                                          "western_adjacency": 32,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 70,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 71,
#                                                          "north_east_adjacency": 69}},
#                                   34: {"adjacencies": {"eastern_adjacency": 35,
#                                                          "western_adjacency": 33,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 69,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 70,
#                                                          "north_east_adjacency": 68}},
#                                   35: {"adjacencies": {"eastern_adjacency": 36,
#                                                          "western_adjacency": 34,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 68,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 69,
#                                                          "north_east_adjacency": 67}},
#                                   36: {"adjacencies": {"eastern_adjacency": 37,
#                                                          "western_adjacency": 35,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 67,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 68,
#                                                          "north_east_adjacency": 66}},
#                                   37: {"adjacencies": {"eastern_adjacency": 38,
#                                                          "western_adjacency": 36,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 66,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 67,
#                                                          "north_east_adjacency": 65}},
#                                   38: {"adjacencies": {"eastern_adjacency": 39,
#                                                          "western_adjacency": 37,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 65,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 66,
#                                                          "north_east_adjacency": 64}},
#                                   39: {"adjacencies": {"eastern_adjacency": 40,
#                                                          "western_adjacency": 38,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 64,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 65,
#                                                          "north_east_adjacency": 63}},
#                                   40: {"adjacencies": {"eastern_adjacency": 41,
#                                                          "western_adjacency": 39,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 63,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 64,
#                                                          "north_east_adjacency": 62}},
#                                   41: {"adjacencies": {"eastern_adjacency": 42,
#                                                          "western_adjacency": 40,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 62,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 63,
#                                                          "north_east_adjacency": 64}},
#                                   42: {"adjacencies": {"eastern_adjacency": 43,
#                                                          "western_adjacency": 41,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 61,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 62,
#                                                          "north_east_adjacency": 60}},
#                                   43: {"adjacencies": {"eastern_adjacency": 44,
#                                                          "western_adjacency": 42,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 60,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 61,
#                                                          "north_east_adjacency": 59}},
#                                   44: {"adjacencies": {"eastern_adjacency": 45,
#                                                          "western_adjacency": 43,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 59,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 60,
#                                                          "north_east_adjacency": 58}},
#                                   45: {"adjacencies": {"eastern_adjacency": 46,
#                                                          "western_adjacency": 44,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 58,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 59,
#                                                          "north_east_adjacency": 57}},
#                                   46: {"adjacencies": {"eastern_adjacency": 47,
#                                                          "western_adjacency": 45,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 57,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 58,
#                                                          "north_east_adjacency": 56}},
#                                   47: {"adjacencies": {"eastern_adjacency": 48,
#                                                          "western_adjacency": 46,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 56,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 57,
#                                                          "north_east_adjacency": 55}},
#                                   48: {"adjacencies": {"eastern_adjacency": 49,
#                                                          "western_adjacency": 47,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 55,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 56,
#                                                          "north_east_adjacency": 54}},
#                                   49: {"adjacencies": {"eastern_adjacency": 50,
#                                                          "western_adjacency": 48,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 54,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 55,
#                                                          "north_east_adjacency": 53}},
#                                   50: {"adjacencies": {"eastern_adjacency": 51,
#                                                          "western_adjacency": 49,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 53,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 54,
#                                                          "north_east_adjacency": 52}},
#                                   51: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 50,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 52,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 53,
#                                                          "north_east_adjacency": None}},
#                                   52: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 53,
#                                                          "southern_adjacency": 51,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 50,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 73}},
#                                   53: {"adjacencies": {"eastern_adjacency": 52,
#                                                          "western_adjacency": 54,
#                                                          "southern_adjacency": 50,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 49,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 51}},
#                                   54: {"adjacencies": {"eastern_adjacency": 53,
#                                                          "western_adjacency": 55,
#                                                          "southern_adjacency": 49,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 48,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 50}},
#                                   55: {"adjacencies": {"eastern_adjacency": 54,
#                                                          "western_adjacency": 56,
#                                                          "southern_adjacency": 48,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 47,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 49}},
#                                   56: {"adjacencies": {"eastern_adjacency": 55,
#                                                          "western_adjacency": 57,
#                                                          "southern_adjacency": 47,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 46,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 48}},
#                                   57: {"adjacencies": {"eastern_adjacency": 56,
#                                                          "western_adjacency": 58,
#                                                          "southern_adjacency": 46,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 45,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 47}},
#                                   58: {"adjacencies": {"eastern_adjacency": 57,
#                                                          "western_adjacency": 59,
#                                                          "southern_adjacency": 45,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 44,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 46}},
#                                   59: {"adjacencies": {"eastern_adjacency": 58,
#                                                          "western_adjacency": 60,
#                                                          "southern_adjacency": 44,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 43,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 45}},
#                                   60: {"adjacencies": {"eastern_adjacency": 59,
#                                                          "western_adjacency": 61,
#                                                          "southern_adjacency": 43,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 42,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 44}},
#                                   61: {"adjacencies": {"eastern_adjacency": 60,
#                                                          "western_adjacency": 62,
#                                                          "southern_adjacency": 42,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 41,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 43}},
#                                   62: {"adjacencies": {"eastern_adjacency": 61,
#                                                          "western_adjacency": 63,
#                                                          "southern_adjacency": 41,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 40,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 42}},
#                                   63: {"adjacencies": {"eastern_adjacency": 62,
#                                                          "western_adjacency": 64,
#                                                          "southern_adjacency": 40,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 39,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 41}},
#                                   64: {"adjacencies": {"eastern_adjacency": 63,
#                                                          "western_adjacency": 65,
#                                                          "southern_adjacency": 39,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 38,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 40}},
#                                   65: {"adjacencies": {"eastern_adjacency": 64,
#                                                          "western_adjacency": 66,
#                                                          "southern_adjacency": 38,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 37,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 39}},
#                                   66: {"adjacencies": {"eastern_adjacency": 65,
#                                                          "western_adjacency": 67,
#                                                          "southern_adjacency": 37,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 36,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 38}},
#                                   67: {"adjacencies": {"eastern_adjacency": 66,
#                                                          "western_adjacency": 68,
#                                                          "southern_adjacency": 36,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 35,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 37}},
#                                   68: {"adjacencies": {"eastern_adjacency": 67,
#                                                          "western_adjacency": 69,
#                                                          "southern_adjacency": 35,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 34,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 36}},
#                                   69: {"adjacencies": {"eastern_adjacency": 68,
#                                                          "western_adjacency": 70,
#                                                          "southern_adjacency": 34,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 33,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 35}},
#                                   70: {"adjacencies": {"eastern_adjacency": 69,
#                                                          "western_adjacency": 71,
#                                                          "southern_adjacency": 33,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 32,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 34}},
#                                   71: {"adjacencies": {"eastern_adjacency": 70,
#                                                          "western_adjacency": 72,
#                                                          "southern_adjacency": 32,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 31,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 33}},
#                                   72: {"adjacencies": {"eastern_adjacency": 71,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 31,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 32}},
#                                   73: {"adjacencies": {"eastern_adjacency": 74,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 52,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   74: {"adjacencies": {"eastern_adjacency": 75,
#                                                          "western_adjacency": 73,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   75: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 74,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   76: {"adjacencies": {"eastern_adjacency": 79,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 77,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 78,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   77: {"adjacencies": {"eastern_adjacency": 78,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 76,
#                                                          "south_east_adjacency": 78,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 79}},
#                                   78: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 77,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 79,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 76,
#                                                          "north_east_adjacency": None}},
#                                   79: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 76,
#                                                          "southern_adjacency": 78,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 77,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   }

pa_cam_to_orient_consideration = {"cam_1": {"west": list(range(1, 8)) + list(range(9, 16)) + list(range(17, 24)) + list(range(25, 31)),
                                            "north_west": list(range(9, 16)) + list(range(25, 31)),
                                            "north": [31]},
                                  "cam_2": {"west": list(range(6, 8)) + list(range(13, 16)) + list(range(17, 24)) + list(range(25, 31)),
                                            "north_west": list(range(13, 16)) + list(range(25, 31)),
                                            "north": [31],
                                            "east": list(range(33, 43)) + [60],
                                            "north_east": list(range(62, 72))},
                                  "cam_3": {"west": list(range(41, 45)),
                                            "east": list(range(47, 53)) + list(range(53, 56)),
                                            "north_east": list(range(53, 56))},
                                  "cam_4": {"west": list(range(48, 52)),
                                            "north": [56]}}

pa_unified_id_to_orientation_consideration = {}
for unified_id in range(1, 61):
    pa_unified_id_to_orientation_consideration[unified_id] = {}
    for cam in pa_cam_to_orient_consideration:
        pa_unified_id_to_orientation_consideration[unified_id][cam] = list()
        for orient in pa_cam_to_orient_consideration[cam]:
            if unified_id in pa_cam_to_orient_consideration[cam][orient]:
                pa_unified_id_to_orientation_consideration[unified_id][cam].append(orient)
        if len(pa_unified_id_to_orientation_consideration[unified_id][cam]) == 0:
            pa_unified_id_to_orientation_consideration[unified_id].pop(cam)


pa_type_space_to_unified_id = {"small": list(range(1, 32)) + list(range(53, 56)) + list(range(58, 61)),
                               "big": list(range(32, 53)) + list(range(56, 58)),
                               "outlier": list(range(1001, 1012))}


pa_cam_to_considered_unified_id = {"cam_1": list(range(1, 32)),
                                   "cam_2": list(range(32, 42)) + list(range(58, 61)) + list(range(1001, 1003)),
                                   "cam_3": list(range(42, 49)) + list(range(1003, 1005)),
                                   "cam_4": list(range(49, 58)) + list(range(1005, 1012))}

f0550ddc3940506ac5c1f5aaebe6a1ebbaa1343a
<mask token>

<mask token>
pa_order_in_json_to_unified_id.update(dict(zip(range(11, 19), range(1004, 
    1012))))
pa_order_in_json_to_unified_id.update(dict(zip(range(19, 50), range(1, 32))))
pa_order_in_json_to_unified_id.update({(50): 1001})
pa_order_in_json_to_unified_id.update(dict(zip(range(51, 54), range(6, 9))))
pa_order_in_json_to_unified_id.update(dict(zip(range(54, 58), range(13, 17))))
pa_order_in_json_to_unified_id.update(dict(zip(range(58, 66), range(17, 25))))
pa_order_in_json_to_unified_id.update(dict(zip(range(66, 73), range(25, 32))))
pa_order_in_json_to_unified_id.update(dict(zip(range(73, 84), range(32, 43))))
pa_order_in_json_to_unified_id.update(dict(zip(range(84, 87), range(58, 61))))
pa_order_in_json_to_unified_id.update(dict(zip(range(87, 89), range(1001, 
    1003))))
pa_order_in_json_to_unified_id.update(dict(zip(range(89, 101), range(41, 53))))
pa_order_in_json_to_unified_id.update(dict(zip(range(101, 106), range(53, 58)))
    )
pa_order_in_json_to_unified_id.update(dict(zip(range(106, 111), range(1003,
    1008))))
pa_order_in_json_to_unified_id.update({(112): 1008, (111): 1009, (113): 1010})
<mask token>
for i in range(1, 61):
    if i == 1:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': i + 8,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': i + 9}}})
    elif i in range(2, 8):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 8,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 7, 'north_east_adjacency': i + 9}}})
    elif i == 8:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 8,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 7, 'north_east_adjacency': None}}})
    elif i == 9:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': i - 8, 'northern_adjacency': None,
            'south_east_adjacency': i - 7, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i in range(10, 16):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': i - 8, 'northern_adjacency': None,
            'south_east_adjacency': i - 7, 'south_west_adjacency': i - 9,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 16:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': i - 8, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': i - 9,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 17:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': i + 8}}})
    elif i in range(18, 24):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 7,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 6, 'north_east_adjacency': i + 8}}})
    elif i == 24:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 7,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 6, 'north_east_adjacency': None}}})
    elif i == 25:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': i - 7, 'northern_adjacency': None,
            'south_east_adjacency': i - 6, 'south_west_adjacency': i - 8,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i in range(26, 31):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': i - 7, 'northern_adjacency': None,
            'south_east_adjacency': i - 6, 'south_west_adjacency': i - 8,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 31:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': i - 7, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': i - 8,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 32:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i in range(33, 52):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 52:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': i + 1}}})
    elif i == 53:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': i - 1,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 54:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 55:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 56:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': None,
            'southern_adjacency': i + 1, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 57:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': i - 1,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 58:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 59:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 60:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
<mask token>
for unified_id in range(1, 61):
    pa_unified_id_to_orientation_consideration[unified_id] = {}
    for cam in pa_cam_to_orient_consideration:
        pa_unified_id_to_orientation_consideration[unified_id][cam] = list()
        for orient in pa_cam_to_orient_consideration[cam]:
            if unified_id in pa_cam_to_orient_consideration[cam][orient]:
                pa_unified_id_to_orientation_consideration[unified_id][cam
                    ].append(orient)
        if len(pa_unified_id_to_orientation_consideration[unified_id][cam]
            ) == 0:
            pa_unified_id_to_orientation_consideration[unified_id].pop(cam)
<mask token>

pa_order_in_json_to_unified_id = dict(zip(range(1, 11), range(48, 58)))
pa_order_in_json_to_unified_id.update(dict(zip(range(11, 19), range(1004, 
    1012))))
pa_order_in_json_to_unified_id.update(dict(zip(range(19, 50), range(1, 32))))
pa_order_in_json_to_unified_id.update({(50): 1001})
pa_order_in_json_to_unified_id.update(dict(zip(range(51, 54), range(6, 9))))
pa_order_in_json_to_unified_id.update(dict(zip(range(54, 58), range(13, 17))))
pa_order_in_json_to_unified_id.update(dict(zip(range(58, 66), range(17, 25))))
pa_order_in_json_to_unified_id.update(dict(zip(range(66, 73), range(25, 32))))
pa_order_in_json_to_unified_id.update(dict(zip(range(73, 84), range(32, 43))))
pa_order_in_json_to_unified_id.update(dict(zip(range(84, 87), range(58, 61))))
pa_order_in_json_to_unified_id.update(dict(zip(range(87, 89), range(1001, 
    1003))))
pa_order_in_json_to_unified_id.update(dict(zip(range(89, 101), range(41, 53))))
pa_order_in_json_to_unified_id.update(dict(zip(range(101, 106), range(53, 58)))
    )
pa_order_in_json_to_unified_id.update(dict(zip(range(106, 111), range(1003,
    1008))))
pa_order_in_json_to_unified_id.update({(112): 1008, (111): 1009, (113): 1010})
pa_cam_to_space_id = {'cam_1': list(range(19, 51)), 'cam_2': list(range(51,
    89)), 'cam_3': list(range(89, 114)), 'cam_4': list(range(1, 19))}
pa_cam_to_unified_id = {k: list(map(lambda x:
    pa_order_in_json_to_unified_id[x], v)) for k, v in pa_cam_to_space_id.
    items()}
pa_unified_id_and_adjacency_ids = {}
for i in range(1, 61):
    if i == 1:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': i + 8,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': i + 9}}})
    elif i in range(2, 8):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 8,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 7, 'north_east_adjacency': i + 9}}})
    elif i == 8:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 8,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 7, 'north_east_adjacency': None}}})
    elif i == 9:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': i - 8, 'northern_adjacency': None,
            'south_east_adjacency': i - 7, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i in range(10, 16):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': i - 8, 'northern_adjacency': None,
            'south_east_adjacency': i - 7, 'south_west_adjacency': i - 9,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 16:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': i - 8, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': i - 9,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 17:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': i + 8}}})
    elif i in range(18, 24):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 7,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 6, 'north_east_adjacency': i + 8}}})
    elif i == 24:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': i + 7,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': i + 6, 'north_east_adjacency': None}}})
    elif i == 25:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': i - 7, 'northern_adjacency': None,
            'south_east_adjacency': i - 6, 'south_west_adjacency': i - 8,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i in range(26, 31):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': i - 7, 'northern_adjacency': None,
            'south_east_adjacency': i - 6, 'south_west_adjacency': i - 8,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 31:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': i - 7, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': i - 8,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 32:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i in range(33, 52):
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 52:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': i + 1}}})
    elif i == 53:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': i - 1,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 54:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 55:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 56:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': None,
            'southern_adjacency': i + 1, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 57:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': i - 1,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 58:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 59:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': i + 1, 'western_adjacency': None,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
    elif i == 60:
        pa_unified_id_and_adjacency_ids.update({i: {'adjacencies': {
            'eastern_adjacency': None, 'western_adjacency': i - 1,
            'southern_adjacency': None, 'northern_adjacency': None,
            'south_east_adjacency': None, 'south_west_adjacency': None,
            'north_west_adjacency': None, 'north_east_adjacency': None}}})
pa_cam_to_orient_consideration = {'cam_1': {'west': list(range(1, 8)) +
    list(range(9, 16)) + list(range(17, 24)) + list(range(25, 31)),
    'north_west': list(range(9, 16)) + list(range(25, 31)), 'north': [31]},
    'cam_2': {'west': list(range(6, 8)) + list(range(13, 16)) + list(range(
    17, 24)) + list(range(25, 31)), 'north_west': list(range(13, 16)) +
    list(range(25, 31)), 'north': [31], 'east': list(range(33, 43)) + [60],
    'north_east': list(range(62, 72))}, 'cam_3': {'west': list(range(41, 45
    )), 'east': list(range(47, 53)) + list(range(53, 56)), 'north_east':
    list(range(53, 56))}, 'cam_4': {'west': list(range(48, 52)), 'north': [56]}
    }
pa_unified_id_to_orientation_consideration = {}
for unified_id in range(1, 61):
    pa_unified_id_to_orientation_consideration[unified_id] = {}
    for cam in pa_cam_to_orient_consideration:
        pa_unified_id_to_orientation_consideration[unified_id][cam] = list()
        for orient in pa_cam_to_orient_consideration[cam]:
            if unified_id in pa_cam_to_orient_consideration[cam][orient]:
                pa_unified_id_to_orientation_consideration[unified_id][cam
                    ].append(orient)
        if len(pa_unified_id_to_orientation_consideration[unified_id][cam]
            ) == 0:
            pa_unified_id_to_orientation_consideration[unified_id].pop(cam)
pa_type_space_to_unified_id = {'small': list(range(1, 32)) + list(range(53,
    56)) + list(range(58, 61)), 'big': list(range(32, 53)) + list(range(56,
    58)), 'outlier': list(range(1001, 1012))}
pa_cam_to_considered_unified_id = {'cam_1': list(range(1, 32)), 'cam_2': 
    list(range(32, 42)) + list(range(58, 61)) + list(range(1001, 1003)),
    'cam_3': list(range(42, 49)) + list(range(1003, 1005)), 'cam_4': list(
    range(49, 58)) + list(range(1005, 1012))}

#Image id 0 - cam 4

pa_order_in_json_to_unified_id = dict(zip(range(1, 11), range(48, 58)))
pa_order_in_json_to_unified_id.update(dict(zip(range(11, 19), range(1004, 1012))))

#Image id 1 - cam 1

pa_order_in_json_to_unified_id.update(dict(zip(range(19, 50), range(1, 32))))
pa_order_in_json_to_unified_id.update({50: 1001})

# Image id 2 - cam 2

pa_order_in_json_to_unified_id.update(dict(zip(range(51, 54), range(6, 9))))
pa_order_in_json_to_unified_id.update(dict(zip(range(54, 58), range(13, 17))))
pa_order_in_json_to_unified_id.update(dict(zip(range(58, 66), range(17, 25))))
pa_order_in_json_to_unified_id.update(dict(zip(range(66, 73), range(25, 32))))
pa_order_in_json_to_unified_id.update(dict(zip(range(73, 84), range(32, 43))))
pa_order_in_json_to_unified_id.update(dict(zip(range(84, 87), range(58, 61))))
pa_order_in_json_to_unified_id.update(dict(zip(range(87, 89), range(1001, 1003))))

# Image id 3 - cam 3

pa_order_in_json_to_unified_id.update(dict(zip(range(89, 101), range(41, 53))))
pa_order_in_json_to_unified_id.update(dict(zip(range(101, 106), range(53, 58))))
pa_order_in_json_to_unified_id.update(dict(zip(range(106, 111), range(1003, 1008))))
pa_order_in_json_to_unified_id.update({112: 1008, 111: 1009, 113: 1010})

pa_cam_to_space_id = {"cam_1": list(range(19, 51)),
                      "cam_2": list(range(51, 89)),
                      "cam_3": list(range(89, 114)),
                      "cam_4": list(range(1, 19))}

pa_cam_to_unified_id = {k: list(map(lambda x: pa_order_in_json_to_unified_id[x], v)) for k, v in pa_cam_to_space_id.items()}

pa_unified_id_and_adjacency_ids = {}

for i in range(1, 61):
    if i == 1:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                   "western_adjacency": None,
                                                                   "southern_adjacency": None,
                                                                   "northern_adjacency": i + 8,
                                                                   "south_east_adjacency": None,
                                                                   "south_west_adjacency": None,
                                                                   "north_west_adjacency": None,
                                                                   "north_east_adjacency": i + 9}}})
    elif i in range(2, 8):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 8,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 7,
                                                                    "north_east_adjacency": i + 9}}})
    elif i == 8:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 8,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 7,
                                                                    "north_east_adjacency": None}}})
    elif i == 9:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": i - 8,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 7,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i in range(10, 16):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 8,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 7,
                                                                    "south_west_adjacency": i - 9,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 16:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 8,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": i - 9,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 17:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": i + 8}}})
    elif i in range(18, 24):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 7,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 6,
                                                                    "north_east_adjacency": i + 8}}})
    elif i == 24:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i + 7,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": i + 6,
                                                                    "north_east_adjacency": None}}})
    elif i == 25:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": i - 7,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 6,
                                                                    "south_west_adjacency": i - 8,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i in range(26, 31):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 7,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": i - 6,
                                                                    "south_west_adjacency": i - 8,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 31:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": i - 7,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": i - 8,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 32:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i in range(33, 52):
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 52:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": i + 1}}})
    elif i == 53:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": i - 1,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 54:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 55:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 56:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": i + 1,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 57:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": i - 1,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 58:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 59:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": i + 1,
                                                                    "western_adjacency": None,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})
    elif i == 60:
        pa_unified_id_and_adjacency_ids.update({i: {"adjacencies": {"eastern_adjacency": None,
                                                                    "western_adjacency": i - 1,
                                                                    "southern_adjacency": None,
                                                                    "northern_adjacency": None,
                                                                    "south_east_adjacency": None,
                                                                    "south_west_adjacency": None,
                                                                    "north_west_adjacency": None,
                                                                    "north_east_adjacency": None}}})

#pa_unified_id_and_adjacency_ids = {0: {"adjacencies": {"eastern_adjacency": 1,
#                                                         "western_adjacency": None,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 15,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                       "north_west_adjacency": None,
#                                                       "north_east_adjacency": 14}},
#                                   1: {"adjacencies": {"eastern_adjacency": 2,
#                                                         "western_adjacency": 0,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 14,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 15,
#                                                         "north_east_adjacency": 13}},
#                                   2: {"adjacencies": {"eastern_adjacency": 3,
#                                                         "western_adjacency": 1,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 13,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 14,
#                                                         "north_east_adjacency": 12}},
#                                   3: {"adjacencies": {"eastern_adjacency": 4,
#                                                         "western_adjacency": 2,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 12,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 13,
#                                                         "north_east_adjacency": 11}},
#                                   4: {"adjacencies": {"eastern_adjacency": 5,
#                                                         "western_adjacency": 3,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 11,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 12,
#                                                         "north_east_adjacency": 10}},
#                                   5: {"adjacencies": {"eastern_adjacency": 6,
#                                                         "western_adjacency": 4,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 10,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 11,
#                                                         "north_east_adjacency": 9}},
#                                   6: {"adjacencies": {"eastern_adjacency": 7,
#                                                         "western_adjacency": 5,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 9,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 10,
#                                                         "north_east_adjacency": 8}},
#                                   7: {"adjacencies": {"eastern_adjacency": None,
#                                                         "western_adjacency": 6,
#                                                         "southern_adjacency": None,
#                                                         "northern_adjacency": 8,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": None,
#                                                         "north_west_adjacency": 9,
#                                                         "north_east_adjacency": None}},
#                                   8: {"adjacencies": {"eastern_adjacency": None,
#                                                         "western_adjacency": 9,
#                                                         "southern_adjacency": 7,
#                                                         "northern_adjacency": None,
#                                                         "south_east_adjacency": None,
#                                                         "south_west_adjacency": 6,
#                                                         "north_west_adjacency": None,
#                                                         "north_east_adjacency": None}},
#                                   9: {"adjacencies": {"eastern_adjacency": 8,
#                                                         "western_adjacency": 10,
#                                                         "southern_adjacency": 6,
#                                                         "northern_adjacency": None,
#                                                         "south_east_adjacency": 7,
#                                                         "south_west_adjacency": 5,
#                                                         "north_west_adjacency": None,
#                                                         "north_east_adjacency": None}},
#                                   10: {"adjacencies": {"eastern_adjacency": 9,
#                                                          "western_adjacency": 11,
#                                                          "southern_adjacency": 5,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 6,
#                                                          "south_west_adjacency": 4,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   11: {"adjacencies": {"eastern_adjacency": 10,
#                                                          "western_adjacency": 12,
#                                                          "southern_adjacency": 4,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 5,
#                                                          "south_west_adjacency": 3,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   12: {"adjacencies": {"eastern_adjacency": 11,
#                                                          "western_adjacency": 13,
#                                                          "southern_adjacency": 3,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 4,
#                                                          "south_west_adjacency": 2,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   13: {"adjacencies": {"eastern_adjacency": 12,
#                                                          "western_adjacency": 14,
#                                                          "southern_adjacency": 2,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 3,
#                                                          "south_west_adjacency": 1,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   14: {"adjacencies": {"eastern_adjacency": 13,
#                                                          "western_adjacency": 15,
#                                                          "southern_adjacency": 1,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 2,
#                                                          "south_west_adjacency": 0,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   15: {"adjacencies": {"eastern_adjacency": 14,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 0,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 1,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   16: {"adjacencies": {"eastern_adjacency": 17,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 30}},
#                                   17: {"adjacencies": {"eastern_adjacency": 18,
#                                                          "western_adjacency": 16,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 30,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 29}},
#                                   18: {"adjacencies": {"eastern_adjacency": 19,
#                                                          "western_adjacency": 17,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 29,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 30,
#                                                          "north_east_adjacency": 28}},
#                                   19: {"adjacencies": {"eastern_adjacency": 20,
#                                                          "western_adjacency": 18,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 28,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 29,
#                                                          "north_east_adjacency": 27}},
#                                   20: {"adjacencies": {"eastern_adjacency": 21,
#                                                          "western_adjacency": 19,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 27,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 28,
#                                                          "north_east_adjacency": 26}},
#                                   21: {"adjacencies": {"eastern_adjacency": 22,
#                                                          "western_adjacency": 20,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 26,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 27,
#                                                          "north_east_adjacency": 25}},
#                                   22: {"adjacencies": {"eastern_adjacency": 23,
#                                                          "western_adjacency": 21,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 25,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 26,
#                                                          "north_east_adjacency": 24}},
#                                   23: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 22,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 24,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 25,
#                                                          "north_east_adjacency": None}},
#                                   24: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 25,
#                                                          "southern_adjacency": 23,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 22,
#                                                          "north_east_adjacency": None}},
#                                   25: {"adjacencies": {"eastern_adjacency": 24,
#                                                          "western_adjacency": 26,
#                                                          "southern_adjacency": 22,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 23,
#                                                          "south_west_adjacency": 21,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   26: {"adjacencies": {"eastern_adjacency": 25,
#                                                          "western_adjacency": 27,
#                                                          "southern_adjacency": 21,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 22,
#                                                          "south_west_adjacency": 20,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   27: {"adjacencies": {"eastern_adjacency": 26,
#                                                          "western_adjacency": 27,
#                                                          "southern_adjacency": 20,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 21,
#                                                          "south_west_adjacency": 19,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   28: {"adjacencies": {"eastern_adjacency": 27,
#                                                          "western_adjacency": 29,
#                                                          "southern_adjacency": 19,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 20,
#                                                          "south_west_adjacency": 18,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   29: {"adjacencies": {"eastern_adjacency": 28,
#                                                          "western_adjacency": 30,
#                                                          "southern_adjacency": 18,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 19,
#                                                          "south_west_adjacency": 17,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   30: {"adjacencies": {"eastern_adjacency": 29,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 17,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 18,
#                                                          "south_west_adjacency": 16,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   31: {"adjacencies": {"eastern_adjacency": 32,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 72,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 71}},
#                                   32: {"adjacencies": {"eastern_adjacency": 33,
#                                                          "western_adjacency": 31,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 71,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 72,
#                                                          "north_east_adjacency": 70}},
#                                   33: {"adjacencies": {"eastern_adjacency": 34,
#                                                          "western_adjacency": 32,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 70,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 71,
#                                                          "north_east_adjacency": 69}},
#                                   34: {"adjacencies": {"eastern_adjacency": 35,
#                                                          "western_adjacency": 33,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 69,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 70,
#                                                          "north_east_adjacency": 68}},
#                                   35: {"adjacencies": {"eastern_adjacency": 36,
#                                                          "western_adjacency": 34,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 68,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 69,
#                                                          "north_east_adjacency": 67}},
#                                   36: {"adjacencies": {"eastern_adjacency": 37,
#                                                          "western_adjacency": 35,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 67,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 68,
#                                                          "north_east_adjacency": 66}},
#                                   37: {"adjacencies": {"eastern_adjacency": 38,
#                                                          "western_adjacency": 36,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 66,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 67,
#                                                          "north_east_adjacency": 65}},
#                                   38: {"adjacencies": {"eastern_adjacency": 39,
#                                                          "western_adjacency": 37,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 65,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 66,
#                                                          "north_east_adjacency": 64}},
#                                   39: {"adjacencies": {"eastern_adjacency": 40,
#                                                          "western_adjacency": 38,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 64,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 65,
#                                                          "north_east_adjacency": 63}},
#                                   40: {"adjacencies": {"eastern_adjacency": 41,
#                                                          "western_adjacency": 39,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 63,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 64,
#                                                          "north_east_adjacency": 62}},
#                                   41: {"adjacencies": {"eastern_adjacency": 42,
#                                                          "western_adjacency": 40,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 62,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 63,
#                                                          "north_east_adjacency": 64}},
#                                   42: {"adjacencies": {"eastern_adjacency": 43,
#                                                          "western_adjacency": 41,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 61,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 62,
#                                                          "north_east_adjacency": 60}},
#                                   43: {"adjacencies": {"eastern_adjacency": 44,
#                                                          "western_adjacency": 42,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 60,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 61,
#                                                          "north_east_adjacency": 59}},
#                                   44: {"adjacencies": {"eastern_adjacency": 45,
#                                                          "western_adjacency": 43,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 59,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 60,
#                                                          "north_east_adjacency": 58}},
#                                   45: {"adjacencies": {"eastern_adjacency": 46,
#                                                          "western_adjacency": 44,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 58,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 59,
#                                                          "north_east_adjacency": 57}},
#                                   46: {"adjacencies": {"eastern_adjacency": 47,
#                                                          "western_adjacency": 45,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 57,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 58,
#                                                          "north_east_adjacency": 56}},
#                                   47: {"adjacencies": {"eastern_adjacency": 48,
#                                                          "western_adjacency": 46,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 56,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 57,
#                                                          "north_east_adjacency": 55}},
#                                   48: {"adjacencies": {"eastern_adjacency": 49,
#                                                          "western_adjacency": 47,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 55,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 56,
#                                                          "north_east_adjacency": 54}},
#                                   49: {"adjacencies": {"eastern_adjacency": 50,
#                                                          "western_adjacency": 48,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 54,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 55,
#                                                          "north_east_adjacency": 53}},
#                                   50: {"adjacencies": {"eastern_adjacency": 51,
#                                                          "western_adjacency": 49,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 53,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 54,
#                                                          "north_east_adjacency": 52}},
#                                   51: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 50,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 52,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 53,
#                                                          "north_east_adjacency": None}},
#                                   52: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 53,
#                                                          "southern_adjacency": 51,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 50,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 73}},
#                                   53: {"adjacencies": {"eastern_adjacency": 52,
#                                                          "western_adjacency": 54,
#                                                          "southern_adjacency": 50,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 49,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 51}},
#                                   54: {"adjacencies": {"eastern_adjacency": 53,
#                                                          "western_adjacency": 55,
#                                                          "southern_adjacency": 49,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 48,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 50}},
#                                   55: {"adjacencies": {"eastern_adjacency": 54,
#                                                          "western_adjacency": 56,
#                                                          "southern_adjacency": 48,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 47,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 49}},
#                                   56: {"adjacencies": {"eastern_adjacency": 55,
#                                                          "western_adjacency": 57,
#                                                          "southern_adjacency": 47,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 46,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 48}},
#                                   57: {"adjacencies": {"eastern_adjacency": 56,
#                                                          "western_adjacency": 58,
#                                                          "southern_adjacency": 46,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 45,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 47}},
#                                   58: {"adjacencies": {"eastern_adjacency": 57,
#                                                          "western_adjacency": 59,
#                                                          "southern_adjacency": 45,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 44,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 46}},
#                                   59: {"adjacencies": {"eastern_adjacency": 58,
#                                                          "western_adjacency": 60,
#                                                          "southern_adjacency": 44,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 43,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 45}},
#                                   60: {"adjacencies": {"eastern_adjacency": 59,
#                                                          "western_adjacency": 61,
#                                                          "southern_adjacency": 43,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 42,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 44}},
#                                   61: {"adjacencies": {"eastern_adjacency": 60,
#                                                          "western_adjacency": 62,
#                                                          "southern_adjacency": 42,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 41,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 43}},
#                                   62: {"adjacencies": {"eastern_adjacency": 61,
#                                                          "western_adjacency": 63,
#                                                          "southern_adjacency": 41,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 40,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 42}},
#                                   63: {"adjacencies": {"eastern_adjacency": 62,
#                                                          "western_adjacency": 64,
#                                                          "southern_adjacency": 40,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 39,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 41}},
#                                   64: {"adjacencies": {"eastern_adjacency": 63,
#                                                          "western_adjacency": 65,
#                                                          "southern_adjacency": 39,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 38,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 40}},
#                                   65: {"adjacencies": {"eastern_adjacency": 64,
#                                                          "western_adjacency": 66,
#                                                          "southern_adjacency": 38,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 37,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 39}},
#                                   66: {"adjacencies": {"eastern_adjacency": 65,
#                                                          "western_adjacency": 67,
#                                                          "southern_adjacency": 37,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 36,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 38}},
#                                   67: {"adjacencies": {"eastern_adjacency": 66,
#                                                          "western_adjacency": 68,
#                                                          "southern_adjacency": 36,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 35,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 37}},
#                                   68: {"adjacencies": {"eastern_adjacency": 67,
#                                                          "western_adjacency": 69,
#                                                          "southern_adjacency": 35,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 34,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 36}},
#                                   69: {"adjacencies": {"eastern_adjacency": 68,
#                                                          "western_adjacency": 70,
#                                                          "southern_adjacency": 34,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 33,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 35}},
#                                   70: {"adjacencies": {"eastern_adjacency": 69,
#                                                          "western_adjacency": 71,
#                                                          "southern_adjacency": 33,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 32,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 34}},
#                                   71: {"adjacencies": {"eastern_adjacency": 70,
#                                                          "western_adjacency": 72,
#                                                          "southern_adjacency": 32,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 31,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 33}},
#                                   72: {"adjacencies": {"eastern_adjacency": 71,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 31,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 32}},
#                                   73: {"adjacencies": {"eastern_adjacency": 74,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 52,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   74: {"adjacencies": {"eastern_adjacency": 75,
#                                                          "western_adjacency": 73,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   75: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 74,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   76: {"adjacencies": {"eastern_adjacency": 79,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": 77,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": 78,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   77: {"adjacencies": {"eastern_adjacency": 78,
#                                                          "western_adjacency": None,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 76,
#                                                          "south_east_adjacency": 78,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": 79}},
#                                   78: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 77,
#                                                          "southern_adjacency": None,
#                                                          "northern_adjacency": 79,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": None,
#                                                          "north_west_adjacency": 76,
#                                                          "north_east_adjacency": None}},
#                                   79: {"adjacencies": {"eastern_adjacency": None,
#                                                          "western_adjacency": 76,
#                                                          "southern_adjacency": 78,
#                                                          "northern_adjacency": None,
#                                                          "south_east_adjacency": None,
#                                                          "south_west_adjacency": 77,
#                                                          "north_west_adjacency": None,
#                                                          "north_east_adjacency": None}},
#                                   }

pa_cam_to_orient_consideration = {"cam_1": {"west": list(range(1, 8)) + list(range(9, 16)) + list(range(17, 24)) + list(range(25, 31)),
                                            "north_west": list(range(9, 16)) + list(range(25, 31)),
                                            "north": [31]},
                                  "cam_2": {"west": list(range(6, 8)) + list(range(13, 16)) + list(range(17, 24)) + list(range(25, 31)),
                                            "north_west": list(range(13, 16)) + list(range(25, 31)),
                                            "north": [31],
                                            "east": list(range(33, 43)) + [60],
                                            "north_east": list(range(62, 72))},
                                  "cam_3": {"west": list(range(41, 45)),
                                            "east": list(range(47, 53)) + list(range(53, 56)),
                                            "north_east": list(range(53, 56))},
                                  "cam_4": {"west": list(range(48, 52)),
                                            "north": [56]}}

pa_unified_id_to_orientation_consideration = {}
for unified_id in range(1, 61):
    pa_unified_id_to_orientation_consideration[unified_id] = {}
    for cam in pa_cam_to_orient_consideration:
        pa_unified_id_to_orientation_consideration[unified_id][cam] = list()
        for orient in pa_cam_to_orient_consideration[cam]:
            if unified_id in pa_cam_to_orient_consideration[cam][orient]:
                pa_unified_id_to_orientation_consideration[unified_id][cam].append(orient)
        if len(pa_unified_id_to_orientation_consideration[unified_id][cam]) == 0:
            pa_unified_id_to_orientation_consideration[unified_id].pop(cam)


pa_type_space_to_unified_id = {"small": list(range(1, 32)) + list(range(53, 56)) + list(range(58, 61)),
                               "big": list(range(32, 53)) + list(range(56, 58)),
                               "outlier": list(range(1001, 1012))}


pa_cam_to_considered_unified_id = {"cam_1": list(range(1, 32)),
                                   "cam_2": list(range(32, 42)) + list(range(58, 61)) + list(range(1001, 1003)),
                                   "cam_3": list(range(42, 49)) + list(range(1003, 1005)),
                                   "cam_4": list(range(49, 58)) + list(range(1005, 1012))}
