#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int a[1505][1505];
int X[1125000];
int Y[1125000];
long long dp[1505][1505];
int size1[1505];
int p[1505];
int rank1[1505];
int edges[1505];
int n;
void init() {
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n; i++) {
    dp[i][1] = 1;
    size1[i] = 1;
    p[i] = i;
    rank1[i] = 0;
    edges[i] = 0;
  }
}
int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
long long temp[1505];
void unionSet(int i, int j) {
  int x = findSet(i);
  int y = findSet(j);
  if (x == y) {
    edges[x]++;
    if (edges[x] == size1[x] * (size1[x] - 1) / 2) {
      dp[x][1] = (dp[x][1] + 1) % MOD;
    }
  } else {
    for (int k3 = 1; k3 <= size1[x] + size1[y]; k3++) {
      temp[k3] = 0;
    }
    for (int k1 = 1; k1 <= size1[x]; k1++) {
      for (int k2 = 1; k2 <= size1[y]; k2++) {
        temp[k1 + k2] += dp[x][k1] * dp[y][k2] % MOD;
      }
    }
    if (rank1[x] > rank1[y]) {
      for (int k3 = 1; k3 <= size1[x] + size1[y]; k3++) {
        dp[x][k3] = temp[k3] % MOD;
      }
      p[y] = x;
      size1[x] += size1[y];
      edges[x] += edges[y] + 1;
      if (edges[x] == size1[x] * (size1[x] - 1) / 2) {
        dp[x][1] = (dp[x][1] + 1) % MOD;
      }
    } else {
      for (int k3 = 1; k3 <= size1[x] + size1[y]; k3++) {
        dp[y][k3] = temp[k3] % MOD;
      }
      p[x] = y;
      size1[y] += size1[x];
      edges[y] += edges[x] + 1;
      if (rank1[x] == rank1[y]) {
        rank1[y]++;
      }
      if (edges[y] == size1[y] * (size1[y] - 1) / 2) {
        dp[y][1] = (dp[y][1] + 1) % MOD;
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
      X[a[i][j]] = i;
      Y[a[i][j]] = j;
    }
  }
  init();
  for (int i = 1; i <= n * (n - 1) / 2; i++) {
    unionSet(X[i], Y[i]);
  }
  int z = findSet(0);
  for (int i = 1; i <= n; i++) {
    printf("%lld ", dp[z][i]);
  }
  return 0;
}
