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

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

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

n = A("n")
d = B("d")
j = C("j")
l = A("l")
a = C("a")
h = B("h")
e = A("e")
i = C("i")

n.v = e
n.z = j
n.u = d
d.y = i
d.z = h
d.w = n
j.r = i
j.t = l
l.v = e
l.z = a
l.u = h
a.r = i
a.t = l
h.y = j
h.z = d
h.w = n
e.v = l
e.z = j
e.u = d
i.r = a
i.t = l
assert a.r.t.u.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

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

n = A("n")
d = B("d")
j = C("j")
l = A("l")
a = C("a")
h = B("h")
e = A("e")
i = C("i")

n.v = e
n.z = j
n.u = d
d.y = i
d.z = h
d.w = n
j.r = i
j.t = l
l.v = e
l.z = a
l.u = h
a.r = i
a.t = l
h.y = j
h.z = d
h.w = n
e.v = l
e.z = j
e.u = d
i.r = a
i.t = l
assert a.r.t.u.z.y.txt == "i"