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

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

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

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

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

h = A("h")
e = B("e")
i = C("i")
c = D("c")
l = E("l")
m = C("m")
n = C("n")

h.w = i
h.p = e
h.q = e
e.p = c
i.q = c
i.v = c
i.r = m
i.x = m
i.u = h
c.r = e
c.p = e
l.z = e
l.y = h
m.q = c
m.v = c
m.r = i
m.u = h
m.x = n
n.q = c
n.v = c
n.r = m
n.x = m
n.u = h
assert n.x.x.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

h = A("h")
e = B("e")
i = C("i")
c = D("c")
l = E("l")
m = C("m")
n = C("n")

h.w = i
h.p = e
h.q = e
e.p = c
i.q = c
i.v = c
i.r = m
i.x = m
i.u = h
c.r = e
c.p = e
l.z = e
l.y = h
m.q = c
m.v = c
m.r = i
m.u = h
m.x = n
n.q = c
n.v = c
n.r = m
n.x = m
n.u = h
assert n.x.x.r.u.txt == "h"