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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

h.v = m
h.t = a
h.x = a
h.z = i
i.z = a
i.w = a
m.w = i
m.v = a
m.z = h
m.x = d
b.u = d
b.s = d
b.x = d
b.t = i
b.q = h
a.v = i
d.u = b
d.s = b
d.x = b
d.t = i
d.q = h
assert d.q.z.z.v.w.txt == "a"