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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.r: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

h.u = e
h.w = g
h.y = f
h.p = i
a.q = k
a.r = k
a.w = k
b.y = n
b.s = k
b.w = k
b.q = j
b.t = j
g.z = i
k.s = j
j.z = a
f.q = k
f.r = k
f.w = k
n.u = b
n.w = g
n.y = i
n.p = f
i.q = k
i.r = k
i.w = k
e.y = h
e.s = k
e.w = k
e.q = g
e.t = j
assert n.p.w.s.z.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: D = None
        self.y: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.r: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

h.u = e
h.w = g
h.y = f
h.p = i
a.q = k
a.r = k
a.w = k
b.y = n
b.s = k
b.w = k
b.q = j
b.t = j
g.z = i
k.s = j
j.z = a
f.q = k
f.r = k
f.w = k
n.u = b
n.w = g
n.y = i
n.p = f
i.q = k
i.r = k
i.w = k
e.y = h
e.s = k
e.w = k
e.q = g
e.t = j
assert n.p.w.s.z.w.s.txt == "j"