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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

f = A("f")
l = B("l")
c = C("c")
b = D("b")

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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

f = A("f")
l = B("l")
c = C("c")
b = D("b")

f.u = l
f.q = c
f.t = c
l.o = f
l.q = c
l.y = b
l.v = b
c.w = b
b.r = f
b.o = c
assert c.w.r.u.q.txt == "c"