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

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

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

c = A("c")
l = B("l")
h = C("h")
k = A("k")
f = A("f")
m = C("m")
n = C("n")
i = B("i")

c.r = l
c.u = l
c.s = h
l.p = k
l.u = i
l.z = m
h.v = n
h.w = i
k.r = l
k.s = m
k.u = i
f.r = i
f.u = i
f.s = n
m.v = n
m.w = l
n.v = m
n.w = i
i.p = c
i.u = l
i.z = h
assert k.s.v.v.v.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: C = None
        self.u: B = None
        self.txt = txt

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

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

c = A("c")
l = B("l")
h = C("h")
k = A("k")
f = A("f")
m = C("m")
n = C("n")
i = B("i")

c.r = l
c.u = l
c.s = h
l.p = k
l.u = i
l.z = m
h.v = n
h.w = i
k.r = l
k.s = m
k.u = i
f.r = i
f.u = i
f.s = n
m.v = n
m.w = l
n.v = m
n.w = i
i.p = c
i.u = l
i.z = h
assert k.s.v.v.v.w.z.w.txt == "i"