class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: E = None
        self.o: A = None
        self.w: D = None
        self.u: E = None
        self.txt = txt

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

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

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

m.q = c
c.r = e
c.z = e
c.s = n
n.v = c
n.z = b
n.u = b
n.o = m
n.w = e
e.p = b
f.r = n
b.r = n
assert f.r.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: E = None
        self.o: A = None
        self.w: D = None
        self.u: E = None
        self.txt = txt

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

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

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

m.q = c
c.r = e
c.z = e
c.s = n
n.v = c
n.z = b
n.u = b
n.o = m
n.w = e
e.p = b
f.r = n
b.r = n
assert f.r.v.z.txt == "e"