class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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