class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

d = A("d")
b = B("b")
c = C("c")
n = D("n")
e = E("e")
l = C("l")
h = D("h")

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

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

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

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

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

d = A("d")
b = B("b")
c = C("c")
n = D("n")
e = E("e")
l = C("l")
h = D("h")

d.u = n
b.q = c
b.z = d
c.q = l
c.s = l
c.z = e
c.x = n
n.r = h
n.y = e
n.t = c
e.v = n
e.r = n
e.w = d
e.u = d
l.q = c
l.s = c
l.z = e
l.x = n
h.r = n
h.y = e
h.t = l
assert n.r.t.z.v.txt == "n"