solving a magic square in prolog