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

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

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

e = A("e")
g = B("g")
f = C("f")
l = C("l")
a = A("a")
b = B("b")
j = B("j")
m = C("m")
d = B("d")
i = B("i")

e.z = i
e.q = f
e.s = a
g.z = m
g.t = d
g.o = e
f.u = a
f.x = e
l.u = a
l.x = e
a.z = d
a.q = l
a.s = e
b.z = l
b.t = g
b.o = e
j.z = m
j.t = d
j.o = a
m.u = a
m.x = a
d.z = m
d.t = j
d.o = a
i.z = m
i.t = d
i.o = e
assert a.s.z.z.x.z.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: C = None
        self.s: A = None
        self.txt = txt

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

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

e = A("e")
g = B("g")
f = C("f")
l = C("l")
a = A("a")
b = B("b")
j = B("j")
m = C("m")
d = B("d")
i = B("i")

e.z = i
e.q = f
e.s = a
g.z = m
g.t = d
g.o = e
f.u = a
f.x = e
l.u = a
l.x = e
a.z = d
a.q = l
a.s = e
b.z = l
b.t = g
b.o = e
j.z = m
j.t = d
j.o = a
m.u = a
m.x = a
d.z = m
d.t = j
d.o = a
i.z = m
i.t = d
i.o = e
assert a.s.z.z.x.z.z.x.txt == "a"