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

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

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

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

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

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

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

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

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

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

b.q = a
b.p = l
b.x = k
b.u = i
n.v = i
n.x = b
i.s = n
l.t = k
l.z = b
l.o = b
l.r = i
a.t = k
a.z = b
a.o = b
a.r = i
k.t = l
k.z = b
k.o = b
k.r = i
assert l.t.r.s.x.txt == "b"