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

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

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

j = A("j")
g = B("g")
c = C("c")
d = A("d")
m = C("m")
h = A("h")
a = A("a")
k = A("k")

j.t = g
j.z = h
j.x = c
g.u = c
g.v = a
c.p = m
c.s = d
d.t = g
d.z = h
d.x = c
m.p = c
m.s = j
h.t = g
h.z = k
h.x = c
a.t = g
a.z = d
a.x = c
k.t = g
k.z = j
k.x = m
assert j.z.z.z.x.s.t.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: A = None
        self.x: C = None
        self.txt = txt

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

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

j = A("j")
g = B("g")
c = C("c")
d = A("d")
m = C("m")
h = A("h")
a = A("a")
k = A("k")

j.t = g
j.z = h
j.x = c
g.u = c
g.v = a
c.p = m
c.s = d
d.t = g
d.z = h
d.x = c
m.p = c
m.s = j
h.t = g
h.z = k
h.x = c
a.t = g
a.z = d
a.x = c
k.t = g
k.z = j
k.x = m
assert j.z.z.z.x.s.t.u.p.txt == "m"