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

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

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

g = A("g")
m = B("m")
a = C("a")
c = A("c")
f = B("f")
j = A("j")
n = C("n")
b = B("b")

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

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

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

g = A("g")
m = B("m")
a = C("a")
c = A("c")
f = B("f")
j = A("j")
n = C("n")
b = B("b")

g.z = c
m.s = a
m.t = c
m.o = j
a.u = c
a.y = g
a.x = b
c.z = j
f.s = a
f.t = j
f.o = g
j.z = c
n.u = g
n.y = g
n.x = f
b.s = n
b.t = c
b.o = g
assert m.t.z.z.z.txt == "j"