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

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

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

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

m = A("m")
e = B("e")
k = C("k")
b = D("b")
d = D("d")

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

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

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

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

m = A("m")
e = B("e")
k = C("k")
b = D("b")
d = D("d")

m.s = b
m.x = b
m.v = k
m.w = k
e.o = k
k.v = m
k.w = m
k.p = d
b.t = d
b.o = m
b.y = k
d.t = b
d.o = m
d.y = k
assert b.o.v.p.o.txt == "m"