#include <bits/stdc++.h>
using namespace std;
int n, a[31000];
vector<int> x, y;
set<int> visx[31000], visy[31000];
bool dfs(int dep) {
  if (dep == n) {
    if (x.size() && y.size()) {
      int i;
      for (i = 0; i < x.size(); i++) cout << x[i] << ' ';
      cout << endl;
      for (i = 0; i < y.size(); i++) cout << y[i] << ' ';
      cout << endl;
      return 1;
    }
    return 0;
  }
  if (x.size() < 2 || (a[dep] - x[x.size() - 1] == x[1] - x[0]) &&
                          !visx[dep].count(x[1] - x[0])) {
    if (x.size() > 1) visx[dep].insert(x[1] - x[0]);
    x.push_back(a[dep]);
    if (dfs(dep + 1)) return 1;
    x.pop_back();
  }
  if (y.size() < 2 || (a[dep] - y[y.size() - 1] == y[1] - y[0]) &&
                          !visy[dep].count(y[1] - y[0])) {
    if (y.size() > 1) visy[dep].insert(y[1] - y[0]);
    y.push_back(a[dep]);
    if (dfs(dep + 1)) return 1;
    y.pop_back();
  }
  return 0;
}
int main() {
  cin >> n;
  int i;
  for (i = 0; i < n; i++) cin >> a[i];
  x.clear();
  y.clear();
  if (!dfs(0)) cout << "No solution" << endl;
  return 0;
}
