#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int) n; i++)
#define ford(i, n) for (int i = (int) n - 1; i >= 0; i--)
#define seta(a, b) memset(a, b, sizeof(a))

const int NMAX = 100010;
const int MMAX = 101;

int n, m, cnt[10], power10[MMAX];
char s[NMAX][MMAX], ans[NMAX][MMAX];

void solve(int x, int y, int d)
{
	forn(yy, y)
	{
		seta(cnt, 0);
		forn(i, n)
			if (s[i][yy] != '.') cnt[s[i][yy] - '0']++;
		int count = 0, zn = 0;
		forn(i, 10)
			if (cnt[i] > 0) count++, zn = i;
		if (count > 1) return;
		forn(i, n)
			ans[i][yy] = '0' + zn;
	}

	for (int yy = y; yy < m; ++yy)
	{
		int f = d, cnt = power10[m - yy - 1];
		if (yy > y) f = 9;
		for (int xx = x; xx >= 0; xx--)
		{
			if (cnt == 0)
			{
				cnt = power10[m - yy - 1];
				f = (f + 9) % 10;
				if (f == 9 && xx < n && yy > 0 && ans[xx + 1][yy - 1] != (ans[xx][yy - 1] - '0' + 1) % 10 + '0')
					return;
			}
			cnt--;
			ans[xx][yy] = '0' + f;
			if (s[xx][yy] != '.' && ans[xx][yy] != s[xx][yy]) return;
		}

		f = d, cnt = 1;
		if (yy > y) f = 9;
		for (int xx = x; xx < n; xx++)
		{
			if (cnt == 0)
			{
				cnt = power10[m - yy - 1];
				f = (f + 1) % 10;
				if (f == 0 && xx > 0 && yy > 0 && ans[xx][yy - 1] != (ans[xx - 1][yy - 1] - '0' + 1) % 10 + '0')
					return;
			}
			cnt--;
			ans[xx][yy] = '0' + f;
			if (s[xx][yy] != '.' && ans[xx][yy] != s[xx][yy]) return;
		}
	}
	
	forn(i, n)
			printf("%s\n", ans[i]);
	exit(0);
}

int main()
{
	freopen("calendar.in", "r", stdin);
	freopen("calendar.out", "w", stdout);

	n = 0;
	while (scanf("%s", s[n]) > 0)
		n++;
	m = strlen(s[0]);
	power10[0] = 1;
	for (int i = 1; i <= m; ++i)
		if (i <= 9) power10[i] = power10[i - 1] * 10;
		else power10[i] = power10[i - 1];

	forn(i, n)
		forn(j, m)
			forn(d, 10)
				solve(i, j, d);

	cout << "no solution" << endl;

	return 0;
}
