#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n; cin >> n; vector a(3, vector(3, n / 3)); int d = n % 3; if (n / 3 % 2 == 0) { if (d >= 1) rep(i, 3) a[i][0]++; if (d >= 2) rep(i, 3) a[i][1]++; } else { if (d >= 1) rep(i, 3) a[0][i]++; if (d >= 2) rep(i, 3) a[1][i]++; } rep(i, 3) { rep(j, 3) { cout << a[i][j] << " "; } cout << endl; } return 0; }