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

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

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

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

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

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

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

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

g.z = a
g.x = f
f.s = g
f.y = g
f.z = h
i.z = h
i.t = h
i.o = g
h.z = e
h.t = e
h.o = g
m.s = g
m.y = a
m.z = c
j.s = g
j.y = a
j.z = i
c.z = h
c.t = h
c.o = g
e.z = h
e.o = g
e.t = c
a.z = g
a.x = f
assert a.x.y.z.z.z.txt == "a"