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

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

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

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

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

i.r = n
i.t = b
n.o = b
n.u = b
n.q = b
b.x = i
j.z = l
j.q = b
j.o = b
j.r = n
l.z = j
l.q = b
l.o = b
l.r = n
assert i.t.x.r.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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

i.r = n
i.t = b
n.o = b
n.u = b
n.q = b
b.x = i
j.z = l
j.q = b
j.o = b
j.r = n
l.z = j
l.q = b
l.o = b
l.r = n
assert i.t.x.r.q.x.txt == "i"