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

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

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

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

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

k.r = a
k.z = b
k.y = b
k.o = b
a.v = k
a.w = b
i.t = k
i.z = k
i.x = b
i.o = b
b.v = a
assert b.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.y: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

k.r = a
k.z = b
k.y = b
k.o = b
a.v = k
a.w = b
i.t = k
i.z = k
i.x = b
i.o = b
b.v = a
assert b.v.w.v.txt == "a"