/* -*- coding: utf-8 -*- * * 3649.cc: No.3649 Top View of Jenga - yukicoder */ #include #include using namespace std; /* constant */ /* typedef */ using ll = long long; /* global variables */ int cs[3][3]; /* subroutines */ /* main */ int main() { ll n; scanf("%lld", &n); ll q = n / 3, r = n % 3; if (r > 0) { if (! (q & 1)) { for (int i = 0; i < r; i++) for (int j = 0; j < 3; j++) cs[j][i]++; } else { for (int i = 0; i < r; i++) for (int j = 0; j < 3; j++) cs[i][j]++; } } for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) printf("%lld%c", q + cs[i][j], (j < 2) ? ' ' : '\n'); return 0; }