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

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

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

a = A("a")
i = B("i")
g = C("g")
k = C("k")
h = B("h")
f = C("f")
c = C("c")
n = A("n")
j = C("j")
e = C("e")

a.y = h
a.t = i
a.o = n
i.z = n
g.q = i
g.o = i
k.q = i
k.o = h
h.z = a
f.q = i
f.o = i
c.q = i
c.o = h
n.y = h
n.t = h
n.o = a
j.q = h
j.o = h
e.q = h
e.o = h
assert h.z.t.z.t.z.t.z.o.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.o: A = None
        self.txt = txt

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

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

a = A("a")
i = B("i")
g = C("g")
k = C("k")
h = B("h")
f = C("f")
c = C("c")
n = A("n")
j = C("j")
e = C("e")

a.y = h
a.t = i
a.o = n
i.z = n
g.q = i
g.o = i
k.q = i
k.o = h
h.z = a
f.q = i
f.o = i
c.q = i
c.o = h
n.y = h
n.t = h
n.o = a
j.q = h
j.o = h
e.q = h
e.o = h
assert h.z.t.z.t.z.t.z.o.t.z.txt == "n"