#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
using namespace std;
int main() {
cin.sync_with_stdio(false);
long long w = 0;
long long h = 0;
long long max = 0;
cin >> w;
cin >> h;
cin >> max;
vector< vector<long long> > ruudukko;
vector<long long> kalvot;
vector<long long> rivi;
for (long long i = 0; i < w; i++) {
for (long long j = 0; j < h; j++) {
long long x;
cin >> x;
rivi.push_back(x);
}
ruudukko.push_back(rivi);
rivi.clear();
}
for (long long i = 0; i < w; i++) {
for (long long j = 0; j < h; j++)
cout << 'V';
cout << '\n';
}
long long tulostettu = 0;
for (long long k = 1; k <= max; k++) {
bool kannattaa_tulostaa = false;
string kalvo;
for (long long i = 0; i < w; i++) {
for (long long j = 0; j < h; j++) {
if (ruudukko[i][j] == k) {
kannattaa_tulostaa = true;
kalvo += 'S';
} else
kalvo += 'L';
}
kalvo += '\n';
}
if (kannattaa_tulostaa) {
cout << kalvo;
tulostettu++;
}
kalvot.push_back(kannattaa_tulostaa);
}
for (; tulostettu < 39; tulostettu++) {
for (long long i = 0; i < w; i++) {
for (long long j = 0; j < h; j++)
cout << 'V';
cout << '\n';
}
}
for (long long k = 1; k <= max; k++) {
cout << k << ' ';
for (long long l = 1; l <= k; l++) {
if (kalvot[l-1] == true) {
cout << l << ' ';
}
}
cout << '\n';
}
}