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

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

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

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

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

f = A("f")
m = B("m")
d = C("d")
k = D("k")
n = E("n")
l = D("l")
b = C("b")

f.q = n
f.p = n
f.v = k
f.t = m
f.y = l
m.z = b
m.v = b
m.u = l
m.t = d
d.r = m
k.r = n
k.p = n
n.z = l
n.w = f
l.r = n
l.p = n
b.r = m
assert l.r.w.p.w.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: D = None
        self.p: E = None
        self.t: B = None
        self.y: D = None
        self.txt = txt

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

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

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

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

f = A("f")
m = B("m")
d = C("d")
k = D("k")
n = E("n")
l = D("l")
b = C("b")

f.q = n
f.p = n
f.v = k
f.t = m
f.y = l
m.z = b
m.v = b
m.u = l
m.t = d
d.r = m
k.r = n
k.p = n
n.z = l
n.w = f
l.r = n
l.p = n
b.r = m
assert l.r.w.p.w.v.r.txt == "n"