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

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

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

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

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

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

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

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

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

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

n.u = e
n.z = f
n.r = f
n.y = h
f.v = n
f.s = j
j.z = f
j.r = e
j.s = h
j.v = n
e.x = n
c.z = f
c.r = e
c.s = h
c.v = n
h.z = f
h.r = e
h.s = j
h.v = n
assert h.z.s.r.x.txt == "n"