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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

a = A("a")
c = B("c")
b = C("b")
j = D("j")
h = E("h")

a.v = c
a.s = j
c.u = a
c.z = a
c.x = b
c.r = h
b.t = h
j.q = b
j.v = c
j.z = c
j.w = h
h.y = j
assert j.v.r.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

a = A("a")
c = B("c")
b = C("b")
j = D("j")
h = E("h")

a.v = c
a.s = j
c.u = a
c.z = a
c.x = b
c.r = h
b.t = h
j.q = b
j.v = c
j.z = c
j.w = h
h.y = j
assert j.v.r.y.v.txt == "c"