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

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

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

f = A("f")
i = B("i")
l = C("l")
m = A("m")
b = C("b")
c = C("c")
e = B("e")
g = A("g")
n = C("n")

f.z = i
f.r = i
f.v = e
i.v = c
i.q = m
i.z = n
l.r = n
l.s = i
m.z = e
m.r = e
m.v = i
b.r = l
b.s = i
c.r = n
c.s = i
e.v = l
e.q = f
e.z = b
g.z = e
g.v = e
g.r = i
n.r = l
n.s = i
assert m.r.z.r.r.r.r.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.v: B = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
l = C("l")
m = A("m")
b = C("b")
c = C("c")
e = B("e")
g = A("g")
n = C("n")

f.z = i
f.r = i
f.v = e
i.v = c
i.q = m
i.z = n
l.r = n
l.s = i
m.z = e
m.r = e
m.v = i
b.r = l
b.s = i
c.r = n
c.s = i
e.v = l
e.q = f
e.z = b
g.z = e
g.v = e
g.r = i
n.r = l
n.s = i
assert m.r.z.r.r.r.r.s.v.txt == "c"