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

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

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

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

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

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

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

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

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

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

i.r = n
i.p = b
k.w = a
k.q = n
k.p = n
a.o = k
a.v = k
a.z = i
n.y = a
b.o = k
b.v = k
b.z = i
assert n.y.v.w.o.q.txt == "n"