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

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

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

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

a.x = k
g.z = k
g.y = e
g.s = j
n.o = k
e.o = c
d.x = k
k.o = n
h.o = k
j.x = h
i.z = n
i.y = e
i.s = j
c.o = e
assert e.o.o.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

a.x = k
g.z = k
g.y = e
g.s = j
n.o = k
e.o = c
d.x = k
k.o = n
h.o = k
j.x = h
i.z = n
i.y = e
i.s = j
c.o = e
assert e.o.o.o.o.o.o.o.o.o.o.txt == "e"