class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: A = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

i = A("i")
j = B("j")
l = C("l")
c = B("c")
f = A("f")
k = A("k")
g = A("g")
b = C("b")

i.p = k
i.t = f
i.z = f
j.s = b
j.p = c
l.z = f
c.s = b
c.p = j
f.p = i
f.t = i
f.z = i
k.p = g
k.t = g
k.z = i
g.p = i
g.z = i
g.t = f
b.z = f
assert i.p.z.z.t.z.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: A = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

i = A("i")
j = B("j")
l = C("l")
c = B("c")
f = A("f")
k = A("k")
g = A("g")
b = C("b")

i.p = k
i.t = f
i.z = f
j.s = b
j.p = c
l.z = f
c.s = b
c.p = j
f.p = i
f.t = i
f.z = i
k.p = g
k.t = g
k.z = i
g.p = i
g.z = i
g.t = f
b.z = f
assert i.p.z.z.t.z.p.p.p.txt == "g"