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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.u: E = None
        self.x: C = None
        self.r: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: A = None
        self.o: A = None
        self.x: B = None
        self.t: A = None
        self.txt = txt

h = A("h")
m = B("m")
d = C("d")
k = D("k")
n = E("n")
j = C("j")
l = D("l")
i = E("i")

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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.u: E = None
        self.x: C = None
        self.r: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: A = None
        self.o: A = None
        self.x: B = None
        self.t: A = None
        self.txt = txt

h = A("h")
m = B("m")
d = C("d")
k = D("k")
n = E("n")
j = C("j")
l = D("l")
i = E("i")

h.v = k
h.u = m
h.w = m
h.q = l
m.z = h
m.s = d
m.u = i
m.x = j
m.r = l
d.u = j
d.q = m
d.r = l
k.p = m
k.r = j
k.w = d
n.r = m
n.x = m
n.w = h
n.o = h
n.t = h
j.u = d
j.q = m
j.r = l
l.p = m
l.r = d
l.w = j
i.r = m
i.x = m
i.w = h
i.o = h
i.t = h
assert m.x.q.r.p.txt == "m"