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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: D = None
        self.v: B = None
        self.txt = txt

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

h = A("h")
n = B("n")
d = C("d")
f = D("f")
c = E("c")
k = C("k")
g = E("g")
m = D("m")

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: D = None
        self.v: B = None
        self.txt = txt

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

h = A("h")
n = B("n")
d = C("d")
f = D("f")
c = E("c")
k = C("k")
g = E("g")
m = D("m")

h.z = n
n.o = c
d.z = k
d.o = k
d.s = n
d.x = f
d.t = g
f.p = d
f.r = m
f.v = n
c.w = k
c.q = n
c.y = m
c.v = h
k.z = d
k.o = d
k.s = n
k.x = f
k.t = g
g.w = d
g.q = n
g.y = f
g.v = h
m.p = k
m.r = f
m.v = n
assert k.t.w.o.s.o.y.r.txt == "f"