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

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

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

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

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

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

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

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

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