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

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

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

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

m = A("m")
i = B("i")
h = C("h")
n = D("n")
e = C("e")
l = D("l")
f = A("f")
j = B("j")

m.t = j
m.v = n
i.v = f
i.t = n
i.y = h
h.s = m
h.u = i
h.p = i
n.y = e
e.s = m
e.u = j
e.p = i
l.y = e
f.t = j
f.v = n
j.v = m
j.t = l
j.y = e
assert n.y.s.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: D = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
h = C("h")
n = D("n")
e = C("e")
l = D("l")
f = A("f")
j = B("j")

m.t = j
m.v = n
i.v = f
i.t = n
i.y = h
h.s = m
h.u = i
h.p = i
n.y = e
e.s = m
e.u = j
e.p = i
l.y = e
f.t = j
f.v = n
j.v = m
j.t = l
j.y = e
assert n.y.s.t.v.txt == "m"