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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: C = None
        self.o: B = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: C = None
        self.o: B = None
        self.t: B = None
        self.txt = txt

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

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

m.v = k
m.p = l
m.t = l
m.r = d
m.x = h
k.r = d
l.q = h
d.p = l
d.x = l
d.o = k
d.t = k
h.w = d
h.y = d
h.v = k
h.z = k
h.s = m
b.v = k
b.p = l
b.t = l
b.r = d
b.x = h
assert h.s.r.x.q.txt == "h"