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

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

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

n = A("n")
l = B("l")
c = C("c")
k = A("k")

n.s = k
n.t = k
l.z = c
c.o = l
c.p = n
k.s = n
k.t = n
assert n.t.t.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: A = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
c = C("c")
k = A("k")

n.s = k
n.t = k
l.z = c
c.o = l
c.p = n
k.s = n
k.t = n
assert n.t.t.s.s.txt == "n"