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

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

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

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

h = A("h")
l = B("l")
n = C("n")
a = D("a")
f = C("f")
i = C("i")
c = B("c")
j = A("j")
d = D("d")
m = D("m")

h.v = c
h.z = a
l.x = d
l.t = n
l.u = a
l.v = c
n.v = f
a.u = n
a.q = c
a.p = j
f.v = n
i.v = n
c.x = m
c.t = f
c.u = d
c.v = l
j.v = c
j.z = d
d.u = f
d.q = l
d.p = j
m.u = f
m.q = l
m.p = j
assert a.q.v.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: D = None
        self.txt = txt

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

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

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

h = A("h")
l = B("l")
n = C("n")
a = D("a")
f = C("f")
i = C("i")
c = B("c")
j = A("j")
d = D("d")
m = D("m")

h.v = c
h.z = a
l.x = d
l.t = n
l.u = a
l.v = c
n.v = f
a.u = n
a.q = c
a.p = j
f.v = n
i.v = n
c.x = m
c.t = f
c.u = d
c.v = l
j.v = c
j.z = d
d.u = f
d.q = l
d.p = j
m.u = f
m.q = l
m.p = j
assert a.q.v.u.p.txt == "j"