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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: A = None
        self.z: C = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
f = C("f")
l = D("l")
e = B("e")
m = B("m")
k = D("k")
i = A("i")

h.q = f
h.p = k
h.v = k
a.t = i
a.x = h
a.z = f
f.v = k
f.w = a
f.t = m
l.q = k
l.t = k
l.s = f
l.w = f
e.t = h
e.x = i
e.z = f
m.t = h
m.x = h
m.z = f
k.q = l
k.t = l
k.s = f
k.w = f
i.q = f
i.p = k
i.v = l
assert i.q.v.q.s.t.x.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: D = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: A = None
        self.z: C = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
f = C("f")
l = D("l")
e = B("e")
m = B("m")
k = D("k")
i = A("i")

h.q = f
h.p = k
h.v = k
a.t = i
a.x = h
a.z = f
f.v = k
f.w = a
f.t = m
l.q = k
l.t = k
l.s = f
l.w = f
e.t = h
e.x = i
e.z = f
m.t = h
m.x = h
m.z = f
k.q = l
k.t = l
k.s = f
k.w = f
i.q = f
i.p = k
i.v = l
assert i.q.v.q.s.t.x.q.t.txt == "m"