class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: E = None
        self.q: C = None
        self.w: D = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

m.o = e
m.t = e
m.q = g
m.w = n
m.r = n
l.v = e
l.x = e
h.v = l
h.u = g
h.s = g
h.y = n
n.o = e
n.x = e
e.w = n
e.x = n
g.v = l
g.u = h
g.s = h
g.y = n
assert h.v.x.x.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: E = None
        self.q: C = None
        self.w: D = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

m.o = e
m.t = e
m.q = g
m.w = n
m.r = n
l.v = e
l.x = e
h.v = l
h.u = g
h.s = g
h.y = n
n.o = e
n.x = e
e.w = n
e.x = n
g.v = l
g.u = h
g.s = h
g.y = n
assert h.v.x.x.o.w.txt == "n"