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

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

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

l = A("l")
a = B("a")
j = C("j")
e = B("e")
d = B("d")

l.r = j
l.s = j
a.u = l
a.z = j
j.q = d
e.u = l
e.z = j
d.u = l
d.z = j
assert d.u.s.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: C = None
        self.txt = txt

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

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

l = A("l")
a = B("a")
j = C("j")
e = B("e")
d = B("d")

l.r = j
l.s = j
a.u = l
a.z = j
j.q = d
e.u = l
e.z = j
d.u = l
d.z = j
assert d.u.s.q.z.q.txt == "d"