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

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

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

l = A("l")
g = B("g")
b = C("b")
c = C("c")
f = B("f")
d = C("d")

l.u = c
l.w = f
l.v = d
g.y = l
b.z = c
b.q = d
b.r = g
c.z = b
c.q = d
c.r = f
f.y = l
d.z = b
d.q = b
d.r = f
assert d.r.y.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: B = None
        self.v: C = None
        self.txt = txt

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

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

l = A("l")
g = B("g")
b = C("b")
c = C("c")
f = B("f")
d = C("d")

l.u = c
l.w = f
l.v = d
g.y = l
b.z = c
b.q = d
b.r = g
c.z = b
c.q = d
c.r = f
f.y = l
d.z = b
d.q = b
d.r = f
assert d.r.y.v.q.txt == "b"