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

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

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

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

m = A("m")
a = B("a")
h = C("h")
i = D("i")
e = A("e")
l = A("l")
n = D("n")
d = D("d")

m.y = h
m.v = h
a.y = h
a.s = h
h.v = a
h.q = d
h.t = i
h.s = l
i.p = a
i.q = a
e.y = h
e.v = h
l.y = h
l.v = h
n.p = a
n.q = a
d.p = a
d.q = a
assert h.v.y.s.y.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: C = None
        self.txt = txt

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

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

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

m = A("m")
a = B("a")
h = C("h")
i = D("i")
e = A("e")
l = A("l")
n = D("n")
d = D("d")

m.y = h
m.v = h
a.y = h
a.s = h
h.v = a
h.q = d
h.t = i
h.s = l
i.p = a
i.q = a
e.y = h
e.v = h
l.y = h
l.v = h
n.p = a
n.q = a
d.p = a
d.q = a
assert h.v.y.s.y.t.q.y.txt == "h"