#include <bits/stdc++.h>
using namespace std;
struct node {
  int idx, val;
  node(int _idx, int _val) : idx(_idx), val(_val) {}
  bool operator<(const node& b) const { return val < b.val; }
};
const int max_l = 1e5 + 10;
vector<node> s;
int a[max_l], b[max_l];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int val;
    scanf("%d", &val);
    s.push_back(node(i, val));
  }
  sort(s.begin(), s.end());
  int k = (n % 3 == 0) ? n / 3 : n / 3 + 1;
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  if (n >= 2) {
    for (int i = 0; i < k; i++) {
      a[s[i].idx] = s[i].val;
      b[s[i + k].idx] = s[i + k].val;
    }
    for (int i = k * 2; i < n; i++) {
      int j = (i - k * 2);
      a[s[i].idx] = s[i].val - (k - (j + 1));
      b[s[i].idx] = k - (j + 1);
    }
  } else {
    a[0] = s[0].val;
    b[0] = 0;
  }
  puts("YES");
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    printf("%d ", b[i]);
  }
  printf("\n");
}
