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

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

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

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

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

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

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

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

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

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

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

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

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