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

class B:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.p: E = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = 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: E = None
        self.o: E = None
        self.t: C = None
        self.txt = txt

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

f.y = g
k.z = m
k.s = h
k.p = l
k.w = n
j.o = k
h.t = a
b.v = l
b.o = l
b.t = j
l.v = b
l.o = b
l.t = a
g.z = m
g.s = h
g.p = l
g.w = n
n.y = g
a.o = g
m.z = g
m.s = h
m.p = l
m.w = n
assert k.p.t.o.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.p: E = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = 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: E = None
        self.o: E = None
        self.t: C = None
        self.txt = txt

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

f.y = g
k.z = m
k.s = h
k.p = l
k.w = n
j.o = k
h.t = a
b.v = l
b.o = l
b.t = j
l.v = b
l.o = b
l.t = a
g.z = m
g.s = h
g.p = l
g.w = n
n.y = g
a.o = g
m.z = g
m.s = h
m.p = l
m.w = n
assert k.p.t.o.z.s.txt == "h"