#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
pair<int, int> a[maxn];
int b[maxn], c[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  if (n == 1) {
    cout << "YES\n";
    cout << 0 << "\n";
    cout << a[0].first;
    return 0;
  }
  sort(a, a + n);
  int m = (n + 2) / 3;
  for (int i = 0; i < m; i++) {
    x = a[i].second;
    b[x] = i;
    c[x] = a[i].first - b[x];
  }
  for (int i = m; i < 2 * m; i++) {
    x = a[i].second;
    c[x] = i;
    b[x] = a[i].first - c[x];
  }
  for (int i = 2 * m; i < n; i++) {
    x = a[i].second;
    c[x] = 3 * m - i - 1;
    b[x] = a[i].first - c[x];
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << "\n";
  for (int i = 0; i < n; i++) {
    cout << c[i] << " ";
  }
}
