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

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

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

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

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

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

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

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

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

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

k.u = i
k.t = l
d.q = l
d.p = k
d.o = b
d.z = b
i.q = l
i.u = l
i.s = d
i.o = d
l.y = k
l.v = k
b.q = l
b.p = k
b.o = d
b.z = d
assert b.p.t.y.u.txt == "i"