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

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

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

i = A("i")
n = B("n")
c = C("c")
l = B("l")
a = A("a")
d = C("d")
m = B("m")
k = A("k")

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

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

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

i = A("i")
n = B("n")
c = C("c")
l = B("l")
a = A("a")
d = C("d")
m = B("m")
k = A("k")

i.r = l
i.z = l
i.s = c
n.s = m
n.p = d
c.x = i
c.s = d
c.t = k
l.s = m
l.p = c
a.r = n
a.z = l
a.s = d
d.x = k
d.s = c
d.t = i
m.s = l
m.p = d
k.r = n
k.z = n
k.s = c
assert a.s.s.x.z.s.txt == "m"