#include <bits/stdc++.h>
struct data {
  int x, id;
};
bool operator<(data const& a, data const& b) { return a.x < b.x; }
int const maxn = 100007;
data da[maxn];
data a[maxn];
data b[maxn];
int n;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> da[i].x;
    da[i].id = i;
  }
  std::sort(da, da + n);
  for (int i = 0; i < n; i++) a[i].id = b[i].id = da[i].id;
  int d = n / 3 + ((n % 3) > 0);
  for (int i = 0; i < d; i++) {
    a[i].x = i;
    b[i].x = da[i].x - i;
  }
  for (int i = d; i < 2 * d; i++) {
    b[i].x = i;
    a[i].x = da[i].x - i;
  }
  for (int i = 2 * d; i < n; i++) {
    b[i].x = n - 1 - i;
    a[i].x = da[i].x - b[i].x;
  }
  std::cout << "YES\n";
  auto cmp = [](data const& a, data const& b) { return a.id < b.id; };
  std::sort(a, a + n, cmp);
  std::sort(b, b + n, cmp);
  for (int i = 0; i < n; i++) std::cout << a[i].x << ' ';
  std::cout << '\n';
  for (int i = 0; i < n; i++) std::cout << b[i].x << ' ';
}
