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

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

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

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

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

k.o = m
k.w = l
b.v = m
b.r = m
b.t = k
b.o = l
l.x = m
m.p = b
m.x = b
m.s = k
m.v = l
assert k.w.x.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

k.o = m
k.w = l
b.v = m
b.r = m
b.t = k
b.o = l
l.x = m
m.p = b
m.x = b
m.s = k
m.v = l
assert k.w.x.x.v.txt == "m"