#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  vector<long long int> s(n);
  map<long long int, pair<long long int, long long int>> val;
  for (long long int j = 0; j < n; j++) {
    cin >> v[j];
    s[j] = v[j];
  }
  sort(v.begin(), v.end());
  long long int mod = (3 - n % 3) % 3;
  for (long long int j = 0; j < (n + mod) / 3; j++) {
    val[v[j]].first = j;
    val[v[j]].second = v[j] - j;
  }
  for (long long int j = (n + mod) / 3; j < 2 * ((n + mod) / 3); j++) {
    val[v[j]].second = j;
    val[v[j]].first = v[j] - j;
  }
  for (long long int j = 2 * ((n + mod) / 3); j < n; j++) {
    val[v[j]].second = n - 1 - j;
    val[v[j]].first = v[j] - (n - 1 - j);
  }
  cout << "YES\n";
  for (long long int j = 0; j < n; j++) cout << val[s[j]].first << " ";
  cout << '\n';
  for (long long int j = 0; j < n; j++) cout << val[s[j]].second << " ";
  cout << '\n';
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
