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

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

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

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

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

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

d.u = a
d.y = f
d.x = e
d.w = j
f.r = d
f.x = e
f.u = e
f.s = i
f.w = k
i.z = k
i.v = k
i.q = d
k.z = m
m.z = e
m.x = e
j.r = d
j.x = m
j.s = a
j.u = e
j.w = k
e.z = m
e.x = m
g.r = d
g.x = e
g.s = i
g.u = m
g.w = k
a.z = k
a.v = k
a.q = d
assert k.z.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.x: E = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

d.u = a
d.y = f
d.x = e
d.w = j
f.r = d
f.x = e
f.u = e
f.s = i
f.w = k
i.z = k
i.v = k
i.q = d
k.z = m
m.z = e
m.x = e
j.r = d
j.x = m
j.s = a
j.u = e
j.w = k
e.z = m
e.x = m
g.r = d
g.x = e
g.s = i
g.u = m
g.w = k
a.z = k
a.v = k
a.q = d
assert k.z.x.z.txt == "m"