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

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

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

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

h = A("h")
i = B("i")
e = C("e")
a = D("a")
b = C("b")
j = B("j")
n = C("n")
k = C("k")
m = B("m")
f = B("f")

h.q = i
h.v = k
i.z = h
e.s = a
e.u = f
a.s = h
a.t = h
a.p = k
b.s = a
b.u = i
j.z = h
n.s = a
n.u = f
k.s = a
k.u = f
m.z = h
f.z = h
assert b.s.p.s.s.q.z.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: C = None
        self.txt = txt

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

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

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

h = A("h")
i = B("i")
e = C("e")
a = D("a")
b = C("b")
j = B("j")
n = C("n")
k = C("k")
m = B("m")
f = B("f")

h.q = i
h.v = k
i.z = h
e.s = a
e.u = f
a.s = h
a.t = h
a.p = k
b.s = a
b.u = i
j.z = h
n.s = a
n.u = f
k.s = a
k.u = f
m.z = h
f.z = h
assert b.s.p.s.s.q.z.v.s.txt == "a"