import json
def main():
    person_tree = {}
    person_tree[0] = [1,2,3,4,7,8,9,10,11]
    person_tree[1] = [0,2,3,5,7]
    person_tree[2] = [0,1,4,6,7]
    person_tree[3] = [0,1]
    person_tree[4] = [0,2]
    person_tree[5] = [1]
    person_tree[6] = [2]
    person_tree[7] = [0,1,2,8]
    person_tree[8] = [0,7]
    person_tree[9] = [0]
    person_tree[10] = [0,11,13,16,19,22]
    person_tree[11] = [0,10]
    person_tree[12] = [13,14]
    person_tree[13] = [10,12]
    person_tree[14] = [12]
    person_tree[15] = [16,17]
    person_tree[16] = [10,15]
    person_tree[17] = [15]
    person_tree[18] = [19,20]
    person_tree[19] = [18,10]
    person_tree[20] = [18]
    person_tree[21] = [22,23]
    person_tree[22] = [21,10]
    person_tree[23] = [21]

    bird_tree = {}
    bird_tree[0] = [1,2,3,4,5]
    bird_tree[1] = [0,2,3]
    bird_tree[2] = [0,1,3]
    bird_tree[3] = [0,1,2]
    bird_tree[4] = [0,5,6,7,8,10,12]
    bird_tree[5] = [0,4]
    bird_tree[6] = [7,4]
    bird_tree[7] = [6,4]
    bird_tree[8] = [4,9]
    bird_tree[9] = [8]
    bird_tree[10] = [11,4]
    bird_tree[11] = [10]
    bird_tree[12] = [4] 

    dog_tree = {}
    dog_tree[0] = [1,2,3,4,5,6,7,17]
    dog_tree[1] = [2,0,3]
    dog_tree[2] = [0,1,4]
    dog_tree[3] = [0,1]
    dog_tree[4] = [0,2]
    dog_tree[5] = [0,1,2]
    dog_tree[6] = [0,8,10,12,14,16,7]
    dog_tree[7] = [0,6]
    dog_tree[8] = [9,6]
    dog_tree[9] = [8]
    dog_tree[10] = [6,11]
    dog_tree[11] = [10]
    dog_tree[12] = [13,6]
    dog_tree[13] = [12]
    dog_tree[14] = [6,15]
    dog_tree[15] = [14]
    dog_tree[16] = [6]
    dog_tree[17] = [0]

    cat_tree = {}
    cat_tree[0] = [1,2,3,4,5,6,7]
    cat_tree[1] = [2,0,3]
    cat_tree[2] = [0,1,4]
    cat_tree[3] = [0,1]
    cat_tree[4] = [0,2]
    cat_tree[5] = [0,1,2]
    cat_tree[6] = [0,8,10,12,14,16,7]
    cat_tree[7] = [0,6]
    cat_tree[8] = [9,6]
    cat_tree[9] = [8]
    cat_tree[10] = [6,11]
    cat_tree[11] = [10]
    cat_tree[12] = [13,6]
    cat_tree[13] = [12]
    cat_tree[14] = [6,15]
    cat_tree[15] = [14]
    cat_tree[16] = [6]

    horse_tree = {}
    horse_tree[0] = [1,2,3,4,5,8,9]
    horse_tree[1] = [2,0,3]
    horse_tree[2] = [0,1,4]
    horse_tree[3] = [0,1]
    horse_tree[4] = [0,2]
    horse_tree[5] = [0,1,2]
    horse_tree[6] = [11] #lfho
    horse_tree[7] = [13] #rfho
    horse_tree[8] = [0,10,12,14,16,18]
    horse_tree[9] = [0,8]
    horse_tree[10] = [8,11,12]
    horse_tree[11] = [10,6]
    horse_tree[12] = [10,8,13]
    horse_tree[13] = [7]
    horse_tree[14] = [8,15,16]
    horse_tree[15] = [14,19]
    horse_tree[16]= [14,17]
    horse_tree[17]= [16,20]
    horse_tree[18]= [8]
    horse_tree[19] = [15]
    horse_tree[20] = [17]

    cow_tree = {}
    cow_tree[0] = [1,2,3,4,5,6,7,8,9]
    cow_tree[1] = [2,0,3,5]
    cow_tree[2] = [0,1,4,5]
    cow_tree[3] = [0,1,6]
    cow_tree[4] = [0,2,7]
    cow_tree[5] = [0,1,2]
    cow_tree[6] = [0,3] #lfho
    cow_tree[7] = [0,4,13] #rfho
    cow_tree[8] = [0,9,10,12,14,16,18]
    cow_tree[9] = [0,8]
    cow_tree[10] = [8,11,12]
    cow_tree[11] = [10,6]
    cow_tree[12] = [10,8,13]
    cow_tree[13] = [7,12]
    cow_tree[14] = [8,15,16]
    cow_tree[15] = [14]
    cow_tree[16]= [8,14,17]
    cow_tree[17]= [16]
    cow_tree[18]= [8]

    motorbike_tree = {}
    motorbike_tree[0] = [14,1,2]
    motorbike_tree[1] = [14,0]
    motorbike_tree[2] = [14,0]
    motorbike_tree[3] = [14]
    motorbike_tree[4] = [14]
    motorbike_tree[5] = [14]
    motorbike_tree[6] = [14]
    motorbike_tree[7] = [14]
    motorbike_tree[8] = [14]
    motorbike_tree[9] = [14]
    motorbike_tree[10]= [14]
    motorbike_tree[11]= [14]
    motorbike_tree[12]= [14]
    motorbike_tree[13]= [14]
    motorbike_tree[14]= [0,1,2,3,4,5,6,7,8,9,10,11,12,13]

    bicycle_tree = {}
    bicycle_tree[0] = [15,1,3]
    bicycle_tree[1] = [15,0,2,4]
    bicycle_tree[2] = [15,1]
    bicycle_tree[3] = [15,0]
    bicycle_tree[4] = [15,1]
    bicycle_tree[5] = [15]
    bicycle_tree[6] = [15]
    bicycle_tree[7] = [15]
    bicycle_tree[8] = [15]
    bicycle_tree[9] = [15]
    bicycle_tree[10]= [15]
    bicycle_tree[11]= [15]
    bicycle_tree[12]= [15]
    bicycle_tree[13]= [15]
    bicycle_tree[14]= [15]
    bicycle_tree[15]= [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]

    aeroplane_tree = {}
    aeroplane_tree[0] = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
    aeroplane_tree[1] = [0]
    aeroplane_tree[2] = [0,3]
    aeroplane_tree[3] = [0,2]
    aeroplane_tree[4] = [0]
    aeroplane_tree[5] = [0]
    aeroplane_tree[6] = [0]
    aeroplane_tree[7] = [0]
    aeroplane_tree[8] = [0]
    aeroplane_tree[9] = [0]
    aeroplane_tree[10]= [0]
    aeroplane_tree[11]= [0]
    aeroplane_tree[12]= [0]
    aeroplane_tree[13]= [0]
    aeroplane_tree[14]= [0]
    aeroplane_tree[15]= [0]
    aeroplane_tree[16]= [0]
    aeroplane_tree[17]= [0]
    aeroplane_tree[18]= [0]
    aeroplane_tree[19]= [0]
    aeroplane_tree[20]= [0]
    aeroplane_tree[21]= [0]
    aeroplane_tree[22]= [0]

    tree = { 'aeroplane':aeroplane_tree, 'motorbike':motorbike_tree,'bicycle':bicycle_tree, 'person':person_tree, 'cow':cow_tree, 'dog':dog_tree, 'cat':cat_tree, 'sheep':cow_tree, 'bird':bird_tree, 'horse':horse_tree }
      
    with open("tree.json", "w") as outfile: 
        json.dump(tree, outfile)
    
if __name__ == "__main__":
    main()