#include <bits/stdc++.h>
const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};
const int N = (int)1e5 + 228;
using namespace std;
int n, s[N], a[N], b[N], p[N], c[N], d[N];
bool cmp(int x, int y) { return s[x] < s[y]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &s[i]), p[i] = i;
  }
  if (n < 2) {
    cout << "YES" << endl;
    for (int i = 1; i <= n; i++) cout << 0 << ' ';
    cout << endl;
    for (int i = 1; i <= n; i++) cout << s[i] << endl;
    return 0;
  }
  sort(p + 1, p + n + 1, &cmp);
  sort(s + 1, s + n + 1);
  int len = (n + 2) / 3;
  for (int i = 0; i < len; i++) {
    a[i + 1] = i;
    b[i + 1] = s[i + 1] - i;
  }
  for (int i = len; i < len + len; i++) {
    b[i + 1] = i;
    a[i + 1] = s[i + 1] - b[i + 1];
  }
  for (int i = 0; i < len; i++) {
    b[i + len + len + 1] = len - i - 1;
    a[i + len + len + 1] = s[1 + i + len + len] - b[i + len + len + 1];
  }
  for (int i = len * 3 + 1; i <= n; i++) a[i] = 0, b[i] = s[i];
  for (int i = 1; i <= n; i++) {
    c[p[i]] = a[i];
    d[p[i]] = b[i];
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) printf("%d ", c[i]);
  printf("\n");
  for (int i = 1; i <= n; i++) printf("%d ", d[i]);
  return 0;
}
