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

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

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

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

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

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

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

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

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

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

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

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

b.p = l
b.w = n
j.z = l
j.r = b
j.t = h
l.t = b
l.v = b
l.u = b
l.s = e
l.q = h
g.r = l
g.s = n
g.p = n
g.z = n
h.t = n
k.z = m
k.r = b
k.t = e
m.t = b
m.v = b
m.u = b
m.s = h
m.q = h
f.z = m
f.r = b
f.t = h
e.t = n
n.r = l
n.s = g
n.p = g
n.z = g
assert k.t.t.r.q.txt == "h"