#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 1000 + 100;
int n;
int s[maxn];
int a[maxn];
int b[maxn];
int p[maxn];
bool cmp(int x, int y) { return s[x] < s[y]; }
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    p[i] = i;
    cin >> s[i];
  }
  sort(p, p + n, cmp);
  for (int i = 0; i < n / 3; ++i) {
    a[p[i]] = i;
    b[p[i]] = s[p[i]] - a[p[i]];
  }
  for (int i = n / 3; i < (2 * n) / 3; ++i) b[p[i]] = s[p[i]];
  for (int i = (2 * n) / 3; i < n; ++i) {
    b[p[i]] = n - i - 1;
    a[p[i]] = s[p[i]] - b[p[i]];
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; ++i) cout << a[i] << " ";
  cout << endl;
  for (int i = 0; i < n; ++i) cout << b[i] << " ";
  cout << endl;
  return 0;
}
