#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void checkMin(T& a, T b) {
  if (a > b) a = b;
}
template <typename T>
inline void checkMax(T& a, T b) {
  if (a < b) a = b;
}
int n, t, m;
vector<pair<int, int>> iv, a, b;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < int(n); ++i) {
    scanf("%d", &t);
    iv.push_back(make_pair(t, i));
  }
  sort((iv).begin(), (iv).end());
  m = (iv.size() + 2) / 3;
  for (int i = 0; i < m; ++i) {
    a.push_back(make_pair(iv[i].second, i));
    b.push_back(make_pair(iv[i].second, iv[i].first - i));
    if (i < n - 1 - i) {
      a.push_back(make_pair(iv[n - 1 - i].second, iv[n - 1 - i].first - i));
      b.push_back(make_pair(iv[n - 1 - i].second, i));
    }
  }
  for (int i = m; i < n - m; ++i) {
    a.push_back(make_pair(iv[i].second, iv[i].first - i));
    b.push_back(make_pair(iv[i].second, i));
  }
  printf("YES\n");
  sort((a).begin(), (a).end());
  sort((b).begin(), (b).end());
  for (auto i : a) {
    printf("%d ", i.second);
  }
  printf("\n");
  for (auto i : b) {
    printf("%d ", i.second);
  }
  printf("\n");
  return 0;
}
