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

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

n.y = c
k.s = j
k.v = c
i.y = j
c.s = j
c.v = k
j.y = i
a.y = k
assert k.s.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

n.y = c
k.s = j
k.v = c
i.y = j
c.s = j
c.v = k
j.y = i
a.y = k
assert k.s.y.y.txt == "j"