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

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

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

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

g.s = c
g.r = c
c.x = m
m.z = a
m.u = a
m.o = c
j.s = c
j.r = c
d.z = e
d.o = c
d.u = m
a.z = m
a.o = c
a.u = d
e.z = m
e.o = c
e.u = d
assert g.s.x.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: B = None
        self.txt = txt

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

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

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

g.s = c
g.r = c
c.x = m
m.z = a
m.u = a
m.o = c
j.s = c
j.r = c
d.z = e
d.o = c
d.u = m
a.z = m
a.o = c
a.u = d
e.z = m
e.o = c
e.u = d
assert g.s.x.u.u.txt == "d"