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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: A = None
        self.q: A = None
        self.p: A = None
        self.t: D = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
b = C("b")
m = D("m")
c = E("c")
h = B("h")
d = D("d")
i = A("i")
a = E("a")

k.q = m
k.w = b
j.s = b
j.y = a
b.r = j
b.x = i
b.q = i
b.p = k
b.t = d
m.q = d
m.p = c
m.v = c
m.t = k
m.z = j
c.r = a
c.z = i
h.s = b
h.y = c
d.q = m
d.p = c
d.v = c
d.t = k
d.z = j
i.q = m
i.w = b
a.r = c
a.z = k
assert j.y.z.w.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: A = None
        self.q: A = None
        self.p: A = None
        self.t: D = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
b = C("b")
m = D("m")
c = E("c")
h = B("h")
d = D("d")
i = A("i")
a = E("a")

k.q = m
k.w = b
j.s = b
j.y = a
b.r = j
b.x = i
b.q = i
b.p = k
b.t = d
m.q = d
m.p = c
m.v = c
m.t = k
m.z = j
c.r = a
c.z = i
h.s = b
h.y = c
d.q = m
d.p = c
d.v = c
d.t = k
d.z = j
i.q = m
i.w = b
a.r = c
a.z = k
assert j.y.z.w.t.q.txt == "m"