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

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

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

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

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

h.v = i
h.r = e
h.u = k
j.w = e
j.q = h
j.u = d
j.p = n
c.s = h
c.o = i
i.w = k
i.t = h
d.s = h
d.o = i
m.w = i
m.q = h
m.u = n
m.p = d
n.s = h
n.o = i
k.w = i
k.q = h
k.u = d
k.p = d
e.w = m
e.t = h
b.w = e
b.q = h
b.u = n
b.p = d
assert m.w.t.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: D = None
        self.u: B = None
        self.txt = txt

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

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

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

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

h.v = i
h.r = e
h.u = k
j.w = e
j.q = h
j.u = d
j.p = n
c.s = h
c.o = i
i.w = k
i.t = h
d.s = h
d.o = i
m.w = i
m.q = h
m.u = n
m.p = d
n.s = h
n.o = i
k.w = i
k.q = h
k.u = d
k.p = d
e.w = m
e.t = h
b.w = e
b.q = h
b.u = n
b.p = d
assert m.w.t.u.q.txt == "h"