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

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

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

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

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

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

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

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

l.r = i
l.z = a
l.x = j
m.u = j
m.o = a
h.z = m
h.y = m
h.w = j
d.r = n
d.z = a
d.x = j
i.z = a
i.w = l
i.y = m
a.u = j
a.o = m
j.r = h
j.z = a
j.x = d
n.z = m
n.y = m
n.w = d
assert h.w.x.z.o.o.u.txt == "j"