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

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

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

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

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

i.w = n
i.v = m
n.t = m
n.o = a
n.s = k
m.o = n
m.w = a
m.v = a
k.s = l
k.u = n
l.t = m
l.o = k
l.s = k
a.s = n
a.u = l
assert k.u.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: C = None
        self.txt = txt

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

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

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

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

i.w = n
i.v = m
n.t = m
n.o = a
n.s = k
m.o = n
m.w = a
m.v = a
k.s = l
k.u = n
l.t = m
l.o = k
l.s = k
a.s = n
a.u = l
assert k.u.t.v.txt == "a"