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

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

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

k = A("k")
f = B("f")
e = C("e")
n = A("n")

k.y = n
f.p = e
e.t = k
n.y = k
assert k.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

k = A("k")
f = B("f")
e = C("e")
n = A("n")

k.y = n
f.p = e
e.t = k
n.y = k
assert k.y.y.y.txt == "n"