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

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

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

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

n = A("n")
j = B("j")
h = C("h")
e = D("e")
d = C("d")
c = C("c")

n.u = c
n.p = e
n.v = j
j.z = e
j.y = h
h.r = j
h.t = j
h.u = e
h.z = n
e.t = d
e.q = n
e.o = n
e.x = c
d.r = j
d.t = j
d.u = e
d.z = n
c.r = j
c.t = j
c.u = e
c.z = n
assert c.u.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: D = None
        self.v: B = None
        self.txt = txt

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

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

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

n = A("n")
j = B("j")
h = C("h")
e = D("e")
d = C("d")
c = C("c")

n.u = c
n.p = e
n.v = j
j.z = e
j.y = h
h.r = j
h.t = j
h.u = e
h.z = n
e.t = d
e.q = n
e.o = n
e.x = c
d.r = j
d.t = j
d.u = e
d.z = n
c.r = j
c.t = j
c.u = e
c.z = n
assert c.u.x.z.txt == "n"