#include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, long long> a[100100];
set<int> st;
set<int> st1;
map<int, int> per;
map<int, int> per1;
int pr(int x) {
  if (!per.count(x)) per[x] = x;
  if (per[x] == x) return x;
  return per[x] = pr(per[x]);
}
int pr1(int x) {
  if (!per1.count(x)) per1[x] = x;
  if (per1[x] == x) return x;
  return per1[x] = pr1(per1[x]);
}
int r1[100100];
int r2[100100];
void in(int val) {
  st.insert(val);
  if (st.count(val + 1)) {
    int t = pr(val);
    int t1 = pr(val + 1);
    per[t] = t1;
  }
  if (st.count(val - 1)) {
    int t1 = pr(val);
    int t = pr(val - 1);
    per[t] = t1;
  }
}
void in1(int val1) {
  st1.insert(val1);
  if (st1.count(val1 + 1)) {
    int t1 = pr1(val1);
    int t = pr1(val1 + 1);
    per1[t] = t1;
  }
  if (st1.count(val1 - 1)) {
    int t = pr1(val1);
    int t1 = pr1(val1 - 1);
    per1[t] = t1;
  }
}
int ii[1000100];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i].first);
    a[i].second = i;
  }
  sort(a, a + n);
  int del1 = 0, del2 = 0, x;
  int up = ceil(1.0 * n / 3.0);
  for (int i = 0; i < n; i++) {
    int val = 0, val1 = a[i].first;
    while (val1 >= 0 && (st.count(val) || st1.count(val1))) {
      if (st.count(val)) {
        val = pr(val) + 1;
        val1 = a[i].first - val;
      }
      if (st1.count(val1)) {
        val1 = pr1(val1) - 1;
        val = a[i].first - val1;
      }
    }
    if (val1 >= 0) {
      in(val);
      in1(val1);
      r1[i] = val;
      r2[i] = val1;
    } else {
      del1++;
      del2++;
      bool ok = del2 > up;
      if (ok) {
        x = pr1(a[i].first);
        if (st1.count(x)) x--;
        if (x >= 0) {
          del2--;
          in1(x);
          r2[i] = x;
          r1[i] = a[i].first - x;
        } else {
          int x1 = pr(0);
          if (st.count(x1)) x1++;
          if (x1 <= a[i].first) {
            del1--;
            in(x1);
            r1[i] = x1;
            r2[i] = a[i].first - x1;
          } else {
            r1[i] = 0;
            r2[i] = a[i].first;
          }
        }
      } else {
        int x1 = pr(0);
        if (st.count(x1)) x1++;
        if (x1 <= a[i].first) {
          del1--;
          in(x1);
          r1[i] = x1;
          r2[i] = a[i].first - x1;
        } else {
          x = pr1(a[i].first);
          if (st1.count(x)) x--;
          if (x >= 0) {
            del2--;
            in1(x);
            r2[i] = x;
            r1[i] = a[i].first - x;
          } else {
            r1[i] = 0;
            r2[i] = a[i].first;
          }
        }
      }
    }
  }
  if (del1 > up || del2 > up) {
    printf("NO\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    ii[a[i].second] = i;
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    printf("%d ", r1[ii[i]]);
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    printf("%d ", r2[ii[i]]);
  }
  return 0;
}
