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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: C = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: E = None
        self.o: C = None
        self.txt = txt

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

n = A("n")
h = B("h")
m = C("m")
a = D("a")
k = E("k")
c = C("c")

n.o = a
n.t = a
h.r = a
h.z = n
h.x = c
m.t = n
m.p = c
m.y = c
m.v = h
a.z = h
a.s = k
a.o = m
k.x = h
k.p = h
k.u = a
k.w = a
k.t = a
c.t = n
c.p = m
c.y = m
c.v = h
assert h.z.o.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: C = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: E = None
        self.o: C = None
        self.txt = txt

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

n = A("n")
h = B("h")
m = C("m")
a = D("a")
k = E("k")
c = C("c")

n.o = a
n.t = a
h.r = a
h.z = n
h.x = c
m.t = n
m.p = c
m.y = c
m.v = h
a.z = h
a.s = k
a.o = m
k.x = h
k.p = h
k.u = a
k.w = a
k.t = a
c.t = n
c.p = m
c.y = m
c.v = h
assert h.z.o.s.t.txt == "a"