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

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

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

k = A("k")
g = B("g")
l = C("l")
h = B("h")
n = B("n")
a = C("a")

k.u = a
k.y = l
g.s = h
l.s = a
h.s = n
n.s = h
a.s = l
assert a.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: C = None
        self.txt = txt

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

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

k = A("k")
g = B("g")
l = C("l")
h = B("h")
n = B("n")
a = C("a")

k.u = a
k.y = l
g.s = h
l.s = a
h.s = n
n.s = h
a.s = l
assert a.s.s.s.s.s.s.txt == "a"