#include <bits/stdc++.h>
using namespace std;
bool ord;
class mazi {
 public:
  int s, a[2];
  int poz;
  bool operator<(const mazi aux) const {
    return ((ord & (s < aux.s)) | ((!ord) & (poz < aux.poz)));
  }
};
mazi v[100000 + 1];
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &v[i].s);
    v[i].poz = i;
  }
  ord = true;
  sort(v + 1, v + n + 1);
  int k = (n - 1) / 3 + 1;
  for (i = 1; i <= k; i++) {
    v[i].a[0] = 0;
    v[i].a[1] = v[i].s;
  }
  for (int j = 0; i <= n; i++) {
    v[i].a[(i - k) & 1] = j;
    v[i].a[(i - k + 1) & 1] = v[i].s - j;
    j += (((i - k) & 1) == 0);
  }
  ord = false;
  sort(v + 1, v + n + 1);
  printf("YES\n");
  for (int j = 0; j < 2; j++) {
    for (i = 1; i <= n; i++) printf("%d ", v[i].a[j]);
    printf("\n");
  }
  return 0;
}
