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

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

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

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

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

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

a.v = b
b.u = f
b.r = e
b.q = a
b.x = h
h.o = f
h.z = n
h.t = e
h.r = a
e.o = b
e.y = b
e.q = a
e.t = a
f.w = e
f.z = b
n.w = e
n.z = b
m.o = f
m.z = n
m.t = e
m.r = a
assert h.t.q.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

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

a.v = b
b.u = f
b.r = e
b.q = a
b.x = h
h.o = f
h.z = n
h.t = e
h.r = a
e.o = b
e.y = b
e.q = a
e.t = a
f.w = e
f.z = b
n.w = e
n.z = b
m.o = f
m.z = n
m.t = e
m.r = a
assert h.t.q.v.q.txt == "a"