"use strict";

function main(input) {
  input = input.trim();

  const ans = fn(parseInt(input));

  for (let i in ans) {
    console.log(ans[i]);
  }
}

function fn(n) {
  let res = [];
  for (let i = 1; i <= n; i++) {
    let num;
    num = first(i);
    if (num == 0) {
      num = second(i);
    }

    res.push(num);
  }
  return res;
}

function first(i) {
  let x = 1;
  let y = 1;
  let z = 1;
  let m = 1;
  let num = 0;
  while (true) {
    if (i == xyz(x, y, z)) {
      if (x == y && y == z && z == x) {
        num = 1;
      } else {
        num = 3;
      }
      break;
    } else if (i < xyz(x, y, z)) {
      break;
    }
    if (m % 3 == 1) {
      x++;
    } else if (m % 3 == 2) {
      y++;
    } else if (m % 3 == 0) {
      z++;
    }
    m++;
  }
  return num;
}

function second(i) {
  let x = 1;
  let y = 1;
  let z = 1;
  let num = 0;
  while (true) {
    if (i == xyz(x, y, z)) {
      if (x == y && y == z && z == x) {
        num = 1;
      } else {
        num = 3;
      }
      break;
    } else if (i < xyz(x, y, z)) {
      break;
    }
    x++;
  }
  return num;
}

function xyz(x, y, z) {
  return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x;
}

function numberSort(array) {
  array.sort(f);
  return array;
}

var f = function (a, b) {
  return a - b;
};

main(require("fs").readFileSync("/dev/stdin", "utf-8"));
