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

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

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

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

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

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

d.y = g
d.u = i
f.u = e
f.o = a
f.s = h
f.w = m
e.t = i
e.u = n
e.o = d
h.q = m
h.z = a
h.r = g
h.p = d
m.v = f
m.o = i
m.t = h
m.u = h
m.s = h
g.y = d
g.u = i
i.t = e
i.u = m
i.o = g
a.u = e
a.o = f
a.s = h
a.w = m
n.v = a
n.o = i
n.t = h
n.u = h
n.s = h
assert h.z.w.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

d.y = g
d.u = i
f.u = e
f.o = a
f.s = h
f.w = m
e.t = i
e.u = n
e.o = d
h.q = m
h.z = a
h.r = g
h.p = d
m.v = f
m.o = i
m.t = h
m.u = h
m.s = h
g.y = d
g.u = i
i.t = e
i.u = m
i.o = g
a.u = e
a.o = f
a.s = h
a.w = m
n.v = a
n.o = i
n.t = h
n.u = h
n.s = h
assert h.z.w.o.t.o.txt == "d"