#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin >> N;
  vector<pair<long long int, long long int> > S(N);
  for (int i = 0; i < N; i++) {
    cin >> S[i].first;
    S[i].second = i;
  }
  sort(S.begin(), S.end());
  vector<long long int> x(N), y(N);
  int lim = N - N % 3;
  for (int i = 0; i < N; i++) {
    if (i < N / 3) {
      x[S[i].second] = i;
    } else if (i < (2 * N) / 3) {
      x[S[i].second] = S[i].first - i;
    } else {
      x[S[i].second] = S[i].first - (N - i - 1);
    }
    y[S[i].second] = S[i].first - x[S[i].second];
  }
  cout << "YES\n";
  for (int i = 0; i < N; i++) {
    cout << x[i] << ' ';
  }
  cout << endl;
  for (int i = 0; i < N; i++) {
    cout << y[i] << ' ';
  }
  return 0;
}
