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

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

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

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

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

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

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

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

h.r = d
h.p = l
h.y = n
d.v = m
d.z = n
l.o = i
l.w = m
m.o = j
m.w = l
k.r = d
k.y = d
k.p = m
i.r = d
i.y = d
i.p = l
j.r = n
j.p = l
j.y = d
n.v = l
n.z = d
assert i.r.z.z.v.w.w.w.w.txt == "m"