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

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

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

j = A("j")
i = B("i")
f = C("f")
a = A("a")
e = C("e")
k = A("k")
n = A("n")

j.s = k
i.v = n
i.r = n
i.z = j
f.v = i
f.x = i
f.s = n
a.s = k
e.v = i
e.x = i
e.s = j
k.s = n
n.s = j
assert e.x.v.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

j = A("j")
i = B("i")
f = C("f")
a = A("a")
e = C("e")
k = A("k")
n = A("n")

j.s = k
i.v = n
i.r = n
i.z = j
f.v = i
f.x = i
f.s = n
a.s = k
e.v = i
e.x = i
e.s = j
k.s = n
n.s = j
assert e.x.v.s.s.txt == "k"