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

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

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

c = A("c")
e = B("e")
n = C("n")
b = B("b")
d = C("d")
j = B("j")
f = A("f")
i = C("i")
h = A("h")

c.z = j
e.o = h
e.t = c
e.x = j
n.o = h
b.o = f
b.t = f
b.x = e
d.o = h
j.o = c
j.t = h
j.x = b
f.z = j
i.o = f
h.z = j
assert e.t.z.o.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
n = C("n")
b = B("b")
d = C("d")
j = B("j")
f = A("f")
i = C("i")
h = A("h")

c.z = j
e.o = h
e.t = c
e.x = j
n.o = h
b.o = f
b.t = f
b.x = e
d.o = h
j.o = c
j.t = h
j.x = b
f.z = j
i.o = f
h.z = j
assert e.t.z.o.z.t.txt == "h"