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

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

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

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

l.z = k
l.u = j
k.w = l
k.p = i
k.r = j
d.u = k
d.x = l
c.z = i
c.u = d
j.u = i
j.x = a
i.w = l
i.p = k
i.r = h
e.z = i
e.u = j
a.z = k
a.u = d
h.u = k
h.x = l
assert d.x.u.u.p.r.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: C = None
        self.txt = txt

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

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

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

l.z = k
l.u = j
k.w = l
k.p = i
k.r = j
d.u = k
d.x = l
c.z = i
c.u = d
j.u = i
j.x = a
i.w = l
i.p = k
i.r = h
e.z = i
e.u = j
a.z = k
a.u = d
h.u = k
h.x = l
assert d.x.u.u.p.r.u.w.txt == "l"