#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int s[N], a[N], b[N], c[N], sa[N], sb[N];
bool cmp(int x, int y) { return s[x] < s[y]; }
int main() {
  int n, i, fg = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    c[i] = i;
  }
  sort(c, c + n, cmp);
  int pa, pb, md = (n + 2) / 3;
  for (int h = 0; h < n; h++) {
    if (h < md)
      a[c[h]] = s[c[h]], b[c[h]] = 0;
    else if (h < 2 * md)
      b[c[h]] = s[c[h]], a[c[h]] = 0;
    else {
      b[c[h]] = md - 1 - (h - 2 * md);
      a[c[h]] = s[c[h]] - b[c[h]];
    }
  }
  for (i = 0; i < n; i++) sa[i] = a[i], sb[i] = b[i];
  sort(sa, sa + n);
  sort(sb, sb + n);
  int k1 = 0, k2 = 0;
  for (i = 0; i < n; i++) {
    if (!i || sa[i] != sa[i - 1]) k1++;
    if (!i || sb[i] != sb[i - 1]) k2++;
  }
  k1 = n - k1;
  k2 = n - k2;
  if (k1 > (n + 2) / 3 || k2 > (n + 2) / 3)
    puts("NO");
  else {
    puts("YES");
    for (i = 0; i < n; i++) printf("%d ", a[i]);
    puts("");
    for (i = 0; i < n; i++) printf("%d ", b[i]);
    puts("");
  }
  return 0;
}
