Problem: Advertising has become part of our routine. And now, in the era of progressive technologies, we need your ideas to make advertising better!

In this problem we'll look at a simplified version of context advertising. You've got a text, consisting of exactly n words. A standard advertising banner has exactly r lines, each line can contain at most c characters. The potential customer always likes it when they can see lots of advertising, so you should determine which maximum number of consecutive words from the text can be written on the banner. Single words in one line of the banner should be separated by spaces. You are allowed to insert more than one space at once. Note that you are not allowed to break the words, that is, each word in the text must occupy exactly one line in the banner. Besides, you cannot change the word order, that is, if you read the banner text consecutively, from top to bottom and from left to right, you should get some consecutive part of the advertisement text.

More formally, the statement can be written like that. Let's say that all words are indexed from 1 to n in the order in which they occur in the advertisement text. Then you have to choose all words, starting from some i-th one and ending with some j-th one (1 ≤ i ≤ j ≤ n), so that all of them could be written on the banner. There must be as many words as possible. See the samples for clarifications.

Input

The first input line contains three integers n, r, c (1 ≤ n, r, c ≤ 106; r × c ≤ 106). The next line contains a text, consisting of n words. The words consist only of lowercase English letters and are not empty. The words in the lines are separated by single spaces. The total number of characters in all words doesn't exceed 5·106.

Output

Print at most r lines, in each line print at most c characters — the optimal advertisement banner. If there are multiple advertisement banners, print any of them. 

Note that some lines of the banner can be empty. You are allowed not to print such lines.

Examples

Input

9 4 12
this is a sample text for croc final round


Output

this is a
sample text
for croc
final round


Input

9 1 9
this is a sample text for croc final round


Output

this is a


Input

6 2 3
croc a a a croc a


Output

a a
a


Input

2 2 5
first second


Output

first

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const long long INF = 1e18;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
const int mn = 1e6 + 2;
string s[mn];
int p2w[6 * mn];
int w2p[mn];
int rr[mn];
vector<int> r2l[mn];
vector<vector<int> > v[mn];
bool cmp(const int &x, const int &y) {
  return v[rr[x]].size() > v[rr[y]].size();
}
int main() {
  int n, rows, cols;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> rows >> cols;
  for (int i = 1; i <= n; i++) cin >> s[i];
  int alen = 0;
  {
    int sidx = 0;
    for (int wi = 1; wi <= n; wi++) {
      w2p[wi] = sidx;
      int slen = s[wi].length();
      for (int i = 0; i < slen; i++) {
        p2w[sidx] = wi;
        sidx++;
      }
      p2w[sidx] = wi + 1;
      sidx++;
    }
    alen = sidx;
  }
  for (int wi = 1; wi <= n; wi++) {
    int spos = w2p[wi];
    int epos = spos + cols;
    int r = n + 1;
    if (epos < alen) r = p2w[epos];
    int l = wi;
    if (r > l) {
      r2l[r].push_back(l);
    }
  }
  for (int x = 0; x <= n + 1; x++) rr[x] = x;
  int bestsz = -1, bestl = 1;
  for (int r = 1; r <= n + 1; r++) {
    int sz = r2l[r].size();
    if (sz > 0) {
      sort(r2l[r].begin(), r2l[r].end(), cmp);
      rr[r] = rr[r2l[r][0]];
    }
    auto &vr = v[rr[r]];
    vector<int> tmp;
    tmp.push_back(r);
    vr.push_back(tmp);
    int rsz = vr.size();
    int rslo = rsz - 1 - rows;
    int rslo0 = max(0, rslo);
    for (int li = 1; li < sz; li++) {
      int l = r2l[r][li];
      auto &vl = v[rr[l]];
      int lsz = vl.size();
      for (int ls = lsz - 1, rs = rsz - 2; ls >= 0 && rs >= rslo0; ls--, rs--) {
        for (auto &w : vl[ls]) {
          vr[rs].push_back(w);
        }
      }
    }
    if (r != n + 1 && s[r].length() <= cols) {
      if (rslo >= 0) {
        for (auto &l : vr[rslo]) {
          int candsz = r - l;
          if (candsz > bestsz) {
            bestsz = candsz;
            bestl = l;
          }
        }
      }
    } else {
      for (int rs = rslo0; rs < rsz; rs++) {
        for (auto &l : vr[rs]) {
          int candsz = r - l;
          if (candsz > bestsz) {
            bestsz = candsz;
            bestl = l;
          }
        }
      }
    }
  }
  while (rows--) {
    int c = -1;
    while (bestl <= n) {
      int slen = 1 + s[bestl].length();
      if (c + slen > cols) {
        break;
      }
      if (c != -1) printf(" ");
      c += slen;
      printf("%s", s[bestl].c_str());
      bestl++;
    }
    printf("\n");
  }
}
static char stdinBuffer[1024];
static char *stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char *stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}