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

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

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

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

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

b = A("b")
m = B("m")
n = C("n")
e = D("e")
f = E("f")
h = E("h")
g = B("g")
k = C("k")

b.x = m
b.y = f
b.q = h
m.w = f
m.y = e
m.p = k
n.u = k
n.o = e
n.v = f
e.t = n
f.v = m
f.x = n
f.y = e
f.z = h
h.v = m
h.x = k
h.y = e
h.z = f
g.w = f
g.y = e
g.p = n
k.u = n
k.o = e
k.v = h
assert m.p.v.z.v.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
n = C("n")
e = D("e")
f = E("f")
h = E("h")
g = B("g")
k = C("k")

b.x = m
b.y = f
b.q = h
m.w = f
m.y = e
m.p = k
n.u = k
n.o = e
n.v = f
e.t = n
f.v = m
f.x = n
f.y = e
f.z = h
h.v = m
h.x = k
h.y = e
h.z = f
g.w = f
g.y = e
g.p = n
k.u = n
k.o = e
k.v = h
assert m.p.v.z.v.w.z.txt == "h"