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

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

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

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

i = A("i")
d = B("d")
k = C("k")
c = D("c")
f = B("f")
m = D("m")

i.x = f
i.y = c
i.s = d
d.v = k
d.o = k
d.t = k
d.w = m
k.s = i
c.u = f
f.v = k
f.o = k
f.t = k
f.w = m
m.u = d
assert m.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: D = None
        self.s: B = None
        self.txt = txt

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

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

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

i = A("i")
d = B("d")
k = C("k")
c = D("c")
f = B("f")
m = D("m")

i.x = f
i.y = c
i.s = d
d.v = k
d.o = k
d.t = k
d.w = m
k.s = i
c.u = f
f.v = k
f.o = k
f.t = k
f.w = m
m.u = d
assert m.u.w.u.txt == "d"