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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: E = None
        self.p: D = None
        self.z: C = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: E = None
        self.p: D = None
        self.z: C = None
        self.t: A = None
        self.txt = txt

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

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

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