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

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

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

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

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

m = A("m")
n = B("n")
a = C("a")
h = D("h")
b = E("b")

m.x = b
m.z = b
m.v = a
m.r = n
m.p = h
n.q = a
a.w = b
a.u = b
a.v = h
h.w = a
h.s = m
b.q = a
assert a.u.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: C = None
        self.r: B = None
        self.z: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

m = A("m")
n = B("n")
a = C("a")
h = D("h")
b = E("b")

m.x = b
m.z = b
m.v = a
m.r = n
m.p = h
n.q = a
a.w = b
a.u = b
a.v = h
h.w = a
h.s = m
b.q = a
assert a.u.q.w.q.txt == "a"