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

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

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

b = A("b")
c = B("c")
e = C("e")
d = B("d")
a = A("a")

b.r = e
b.y = e
b.v = d
c.u = a
c.q = d
e.o = b
e.w = d
e.s = a
d.u = b
d.q = c
a.r = e
a.y = e
a.v = d
assert b.v.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
e = C("e")
d = B("d")
a = A("a")

b.r = e
b.y = e
b.v = d
c.u = a
c.q = d
e.o = b
e.w = d
e.s = a
d.u = b
d.q = c
a.r = e
a.y = e
a.v = d
assert b.v.u.r.txt == "e"