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

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

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

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

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

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

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

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

m.y = l
m.p = j
m.s = c
l.u = a
f.z = b
f.x = g
e.z = f
e.x = c
g.u = e
c.u = e
a.z = b
a.x = l
b.z = f
b.x = g
j.y = g
j.s = g
j.p = m
assert c.u.z.z.x.txt == "g"