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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: B = None
        self.o: A = None
        self.u: A = None
        self.x: D = None
        self.txt = txt

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

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

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

n = A("n")
k = B("k")
i = C("i")
e = D("e")
l = E("l")
m = E("m")
f = A("f")
h = D("h")
a = B("a")

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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: B = None
        self.o: A = None
        self.u: A = None
        self.x: D = None
        self.txt = txt

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

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

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

n = A("n")
k = B("k")
i = C("i")
e = D("e")
l = E("l")
m = E("m")
f = A("f")
h = D("h")
a = B("a")

n.o = a
n.x = e
n.r = l
n.z = l
k.w = e
k.x = e
k.y = a
k.o = f
k.u = n
i.p = l
e.r = f
e.s = i
l.v = a
l.q = a
l.x = i
m.v = k
m.q = k
m.x = i
f.o = k
f.x = e
f.r = m
f.z = m
h.r = f
h.s = i
a.w = e
a.x = e
a.y = k
a.o = f
a.u = f
assert n.x.s.p.q.w.r.txt == "f"