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

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

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

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

l = A("l")
m = B("m")
b = C("b")
i = D("i")
k = D("k")

l.u = b
l.t = b
l.q = k
m.x = l
m.w = l
m.q = l
b.r = m
b.z = l
b.q = i
i.x = m
i.o = l
i.t = b
k.x = m
k.o = l
k.t = b
assert l.q.o.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: D = None
        self.t: C = None
        self.txt = txt

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

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

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

l = A("l")
m = B("m")
b = C("b")
i = D("i")
k = D("k")

l.u = b
l.t = b
l.q = k
m.x = l
m.w = l
m.q = l
b.r = m
b.z = l
b.q = i
i.x = m
i.o = l
i.t = b
k.x = m
k.o = l
k.t = b
assert l.q.o.u.q.txt == "i"