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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.p: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.p: B = None
        self.txt = txt

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

b.y = m
b.t = k
k.o = b
k.t = b
k.u = b
k.y = a
a.p = b
l.z = a
l.v = a
l.p = k
m.z = a
m.v = a
m.p = k
i.o = b
i.t = b
i.u = b
i.y = a
assert k.o.y.p.y.txt == "a"