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

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

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

m = A("m")
f = B("f")
h = C("h")
g = C("g")
e = C("e")
j = C("j")
k = B("k")
a = A("a")
d = B("d")
b = A("b")

m.s = j
m.u = d
m.x = d
f.s = j
h.r = b
g.r = a
e.r = m
j.r = b
k.s = e
a.s = h
a.u = f
a.x = k
d.s = h
b.s = e
b.u = f
b.x = d
assert a.u.s.r.x.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: B = None
        self.x: B = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
h = C("h")
g = C("g")
e = C("e")
j = C("j")
k = B("k")
a = A("a")
d = B("d")
b = A("b")

m.s = j
m.u = d
m.x = d
f.s = j
h.r = b
g.r = a
e.r = m
j.r = b
k.s = e
a.s = h
a.u = f
a.x = k
d.s = h
b.s = e
b.u = f
b.x = d
assert a.u.s.r.x.s.r.txt == "b"