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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: A = None
        self.txt = txt

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

f = A("f")
h = B("h")
k = C("k")
i = A("i")
b = C("b")
e = C("e")
n = B("n")

f.t = b
f.o = b
f.p = h
h.y = n
h.s = i
k.z = h
i.t = e
i.p = h
i.o = b
b.z = h
e.z = n
n.y = h
n.s = i
assert e.z.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: A = None
        self.txt = txt

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

f = A("f")
h = B("h")
k = C("k")
i = A("i")
b = C("b")
e = C("e")
n = B("n")

f.t = b
f.o = b
f.p = h
h.y = n
h.s = i
k.z = h
i.t = e
i.p = h
i.o = b
b.z = h
e.z = n
n.y = h
n.s = i
assert e.z.s.p.txt == "h"