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

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

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

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

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

k = A("k")
a = B("a")
e = C("e")
m = D("m")
j = E("j")
h = E("h")

k.v = j
a.u = h
e.p = a
e.s = a
e.r = j
e.v = j
m.t = j
m.y = e
m.r = e
m.z = k
j.w = k
j.t = a
j.x = m
j.p = e
h.w = k
h.t = a
h.x = m
h.p = e
assert k.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

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

k = A("k")
a = B("a")
e = C("e")
m = D("m")
j = E("j")
h = E("h")

k.v = j
a.u = h
e.p = a
e.s = a
e.r = j
e.v = j
m.t = j
m.y = e
m.r = e
m.z = k
j.w = k
j.t = a
j.x = m
j.p = e
h.w = k
h.t = a
h.x = m
h.p = e
assert k.v.w.v.txt == "j"