class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: C = None
        self.u: D = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.s: B = None
        self.x: D = None
        self.q: D = None
        self.txt = txt

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

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

h = A("h")
c = B("c")
n = C("n")
j = D("j")
g = E("g")

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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: C = None
        self.u: D = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.s: B = None
        self.x: D = None
        self.q: D = None
        self.txt = txt

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

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

h = A("h")
c = B("c")
n = C("n")
j = D("j")
g = E("g")

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