import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main implements Runnable
{
    boolean multiple = true;

    void solve() throws Exception
    {
        ArrayList<Character> chars = new ArrayList<>();
        for (int i = 0; i < 26; i++)
            chars.add((char) ('a' + i));
        for (int i = 0; i < 26; i++)
            chars.add((char) ('A' + i));
        for (int i = 0; i < 10; i++)
            chars.add((char) ('0' + i));

        int r = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        boolean[][] rice = new boolean[r][c];
        char[][] ans = new char[r][c];
        int rCount = 0;
        for (int i = 0; i < r; i++)
        {
            String s = sc.nextToken();
            for (int j = 0; j < c; j++)
                rCount += (rice[i][j] = s.charAt(j) == 'R') ? 1 : 0;
        }

        int target = rCount / k;
        int highCount = rCount - k * (rCount / k);

        int px = 0, py = 0;
        boolean left = true;
        int count = 0;
        int curr = 0;

        while (py < c)
        {
            if ((highCount > 0 && curr == target + 1) || (highCount == 0 && curr == target))
            {
                count++;
                curr = 0;
                if (highCount > 0)
                    highCount--;
            }

            if (rice[px][py])
                curr++;

            ans[px][py] = chars.get(count);

            if (left)
            {
                px++;
                if (px == r)
                {
                    left = !left;
                    px = r - 1;
                    py++;
                }
            }
            else
            {
                px--;
                if (px == -1)
                {
                    left = !left;
                    px = 0;
                    py++;
                }
            }
        }

        for (int i = 0; i < r; i++)
        {
            for (int j = 0; j < c; j++)
            {
                System.out.print(ans[i][j]);
            }
            System.out.println();
        }
    }

    @Override
    public void run()
    {
        try
        {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            if (multiple)
            {
                int q = sc.nextInt();
                for (int i = 0; i < q; i++)
                    solve();
            }
            else
                solve();
        }
        catch (Throwable uncaught)
        {
            Main.uncaught = uncaught;
        }
        finally
        {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable
    {
        Thread thread = new Thread(null, new Main(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Main.uncaught != null) {
            throw Main.uncaught;
        }
    }

    static Throwable uncaught; BufferedReader in; FastScanner sc; PrintWriter out;
}

class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in)
    {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main implements Runnable
{
    boolean multiple = true;

    void solve() throws Exception
    {
        ArrayList<Character> chars = new ArrayList<>();
        for (int i = 0; i < 26; i++)
            chars.add((char) ('a' + i));
        for (int i = 0; i < 26; i++)
            chars.add((char) ('A' + i));
        for (int i = 0; i < 10; i++)
            chars.add((char) ('0' + i));

        int r = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        boolean[][] rice = new boolean[r][c];
        char[][] ans = new char[r][c];
        int rCount = 0;
        for (int i = 0; i < r; i++)
        {
            String s = sc.nextToken();
            for (int j = 0; j < c; j++)
                rCount += (rice[i][j] = s.charAt(j) == 'R') ? 1 : 0;
        }

        int target = rCount / k;
        int highCount = rCount % k;

        int px = 0, py = 0;
        boolean left = true;
        int count = 0;
        int curr = 0;

        while (py < c)
        {
            if ((highCount > 0 && curr == target + 1) || (highCount == 0 && curr == target))
            {
                count++;
                curr = 0;
            }

            if (rice[px][py])
                curr++;

            ans[px][py] = chars.get(count);

            if (left)
            {
                px++;
                if (px == r)
                {
                    left = !left;
                    px = r - 1;
                    py++;
                }
            }
            else
            {
                px--;
                if (px == -1)
                {
                    left = !left;
                    px = 0;
                    py++;
                }
            }
        }

        for (int i = 0; i < r; i++)
        {
            for (int j = 0; j < c; j++)
            {
                System.out.print(ans[i][j]);
            }
            System.out.println();
        }
    }

    @Override
    public void run()
    {
        try
        {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            if (multiple)
            {
                int q = sc.nextInt();
                for (int i = 0; i < q; i++)
                    solve();
            }
            else
                solve();
        }
        catch (Throwable uncaught)
        {
            Main.uncaught = uncaught;
        }
        finally
        {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable
    {
        Thread thread = new Thread(null, new Main(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Main.uncaught != null) {
            throw Main.uncaught;
        }
    }

    static Throwable uncaught; BufferedReader in; FastScanner sc; PrintWriter out;
}

class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in)
    {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main implements Runnable
{
    boolean multiple = true;

    void solve() throws Exception
    {
        ArrayList<Character> chars = new ArrayList<>();
        for (int i = 0; i < 26; i++)
            chars.add((char) ('a' + i));
        for (int i = 0; i < 26; i++)
            chars.add((char) ('A' + i));
        for (int i = 0; i < 10; i++)
            chars.add((char) ('0' + i));

        int r = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        boolean[][] rice = new boolean[r][c];
        char[][] ans = new char[r][c];
        int rCount = 0;
        for (int i = 0; i < r; i++)
        {
            String s = sc.nextToken();
            for (int j = 0; j < c; j++)
                rCount += (rice[i][j] = s.charAt(j) == 'R') ? 1 : 0;
        }

        int target = rCount / k;
        int highCount = k - (rCount % k);

        int px = 0, py = 0;
        boolean left = true;
        int count = 0;
        int curr = 0;

        while (py < c)
        {
            if ((highCount > 0 && curr == target + 1) || (highCount == 0 && curr == target))
            {
                count++;
                curr = 0;
            }

            if (rice[px][py])
                curr++;

            ans[px][py] = chars.get(count);

            if (left)
            {
                px++;
                if (px == r)
                {
                    left = !left;
                    px = r - 1;
                    py++;
                }
            }
            else
            {
                px--;
                if (px == -1)
                {
                    left = !left;
                    px = 0;
                    py++;
                }
            }
        }

        for (int i = 0; i < r; i++)
        {
            for (int j = 0; j < c; j++)
            {
                System.out.print(ans[i][j]);
            }
            System.out.println();
        }
    }

    @Override
    public void run()
    {
        try
        {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            if (multiple)
            {
                int q = sc.nextInt();
                for (int i = 0; i < q; i++)
                    solve();
            }
            else
                solve();
        }
        catch (Throwable uncaught)
        {
            Main.uncaught = uncaught;
        }
        finally
        {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable
    {
        Thread thread = new Thread(null, new Main(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Main.uncaught != null) {
            throw Main.uncaught;
        }
    }

    static Throwable uncaught; BufferedReader in; FastScanner sc; PrintWriter out;
}

class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in)
    {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.util.*;
import java.io.*;

public class D_1255 {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner("test.in");
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt(), m = sc.nextInt();
			int c = sc.nextInt();

			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++)
				grid[i] = sc.next().toCharArray();
			int r = 0;
			for(int i = 0; i < n; i++)
				for(int j = 0; j < m; j++)
					if(grid[i][j] == 'R')
						r++;

			int v1 = r / c, v2 = r / c + 1;
			int c1 = v1 == 0 ? 0 : c - r % c, c2 = r % c;

			ArrayList<Character> list = new ArrayList<>();
			for(char i = '0'; i <= '9'; i++)
				list.add(i);
			for(char i = 'a'; i <= 'z'; i++)
				list.add(i);
			for(char i = 'A'; i <= 'Z'; i++)
				list.add(i);

			char[][] ans = new char[n][m];
			int x = 0, y = 0;
			int charCounter = 0, off = 0, tot = 0;
			int cur = 0;
			while(tot < n * m) {
				tot++;
				if(grid[x][y] == 'R') {
					ans[x][y] = list.get(charCounter);
					cur++;
					if(cur == v1 && c1 > 0) {
						c1--;
						cur = 0;
					} else if(cur == v2) {
						c2--;
						cur = 0;
					}

					if(cur == 0) {
						if(!(c1 == 0 && c2 == 0)) {
							charCounter++;
						}
					}
				} else {
					if(c1 == 0 && c2 == 0 && charCounter != c - 1)
						charCounter++;
					ans[x][y] = list.get(charCounter);
				}

				if(m == 1 || (m % 2 == 1 && off == m / 2)) {
					x++;
					continue;
				}

				if(n == 1) {
					y++;
					continue;
				}

				if(x == off + 1 && y == off) {
					off++;
					y++;
				} else if(x == off && y == off) {
					y++;
				} else if(x == off && y == m - off - 1) {
					x++;
				} else if(x == n - off - 1 && y == m - off - 1) {
					y--;
				} else if(x == n - off - 1 && y == off) {
					x--;
				} else if(x == off) {
					y++;
				} else if(y == m - off - 1) {
					x++;
				} else if(x == n - off - 1) {
					y--;
				} else if(y == off) {
					x--;
				} else {
					System.out.println("I was wrong");
					break;
				}
			}

			for(int i = 0; i < n; i++)
				pw.println(new String(ans[i]));

		}

		pw.flush();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++)
				array[i] = new Integer(nextInt());
			return array;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public static int[] shuffle(int[] a) {
			int n = a.length;
			Random rand = new Random();
			for (int i = 0; i < n; i++) {
				int tmpIdx = rand.nextInt(n);
				int tmp = a[i];
				a[i] = a[tmpIdx];
				a[tmpIdx] = tmp;
			}
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


import java.util.*;
import java.io.*;

public class D_1255 {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt(), m = sc.nextInt();
			int c = sc.nextInt();

			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++)
				grid[i] = sc.next().toCharArray();
			int r = 0;
			for(int i = 0; i < n; i++)
				for(int j = 0; j < m; j++)
					if(grid[i][j] == 'R')
						r++;

			int c1 = c - r % c, c2 = r % c;
			int v1 = r / c, v2 = r / c + 1;

			ArrayList<Character> list = new ArrayList<>();
			for(char i = '0'; i <= '9'; i++)
				list.add(i);
			for(char i = 'a'; i <= 'z'; i++)
				list.add(i);
			for(char i = 'A'; i <= 'Z'; i++)
				list.add(i);

			char[][] ans = new char[n][m];
			int x = 0, y = 0;
			int charCounter = 0, off = 0, tot = 0;
			int cur = 0;
			while(tot < n * m) {
				tot++;
				if(grid[x][y] == 'R') {
					ans[x][y] = list.get(charCounter);
					cur++;
					if(cur == v1 && c1 > 0) {
						c1--;
						cur = 0;
					} else if(cur == v2) {
						c2--;
						cur = 0;
					}

					if(cur == 0) {
						if(!(c1 == 0 && c2 == 0)) {
							charCounter++;
						}
					}

				} else {
					ans[x][y] = list.get(charCounter);
				}

				if(x == off + 1 && y == off) {
					off++;
					y++;
				} else if(x == off && y == off) {
					y++;
				} else if(x == off && y == m - off - 1) {
					x++;
				} else if(x == n - off - 1 && y == m - off - 1) {
					y--;
				} else if(x == n - off - 1 && y == off) {
					x--;
				} else if(x == off) {
					y++;
				} else if(y == m - off - 1) {
					x++;
				} else if(x == n - off - 1) {
					y--;
				} else if(y == off) {
					x--;
				} else {
					System.out.println("I was wrong");
					break;
				}
			}

			for(int i = 0; i < n; i++)
				pw.println(new String(ans[i]));

		}

		pw.flush();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++)
				array[i] = new Integer(nextInt());
			return array;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public static int[] shuffle(int[] a) {
			int n = a.length;
			Random rand = new Random();
			for (int i = 0; i < n; i++) {
				int tmpIdx = rand.nextInt(n);
				int tmp = a[i];
				a[i] = a[tmpIdx];
				a[tmpIdx] = tmp;
			}
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


import java.util.*;
import java.io.*;

public class D_1255 {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt(), m = sc.nextInt();
			int c = sc.nextInt();

			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++)
				grid[i] = sc.next().toCharArray();
			int r = 0;
			for(int i = 0; i < n; i++)
				for(int j = 0; j < m; j++)
					if(grid[i][j] == 'R')
						r++;

			int v1 = r / c, v2 = r / c + 1;
			int c1 = v1 == 0 ? 0 : c - r % c, c2 = r % c;

			ArrayList<Character> list = new ArrayList<>();
			for(char i = '0'; i <= '9'; i++)
				list.add(i);
			for(char i = 'a'; i <= 'z'; i++)
				list.add(i);
			for(char i = 'A'; i <= 'Z'; i++)
				list.add(i);

			char[][] ans = new char[n][m];
			int x = 0, y = 0;
			int charCounter = 0, off = 0, tot = 0;
			int cur = 0;
			while(tot < n * m) {
				tot++;
				if(grid[x][y] == 'R') {
					ans[x][y] = list.get(charCounter);
					cur++;
					if(cur == v1 && c1 > 0) {
						c1--;
						cur = 0;
					} else if(cur == v2) {
						c2--;
						cur = 0;
					}

					if(cur == 0) {
						if(!(c1 == 0 && c2 == 0)) {
							charCounter++;
						}
					}
				} else {
					if(c1 == 0 && c2 == 0 && charCounter != c - 1)
						charCounter++;
					ans[x][y] = list.get(charCounter);
				}

				if(m == 1 || (m % 2 == 1 && off == m / 2)) {
					x++;
					continue;
				}

				if(n == 1) {
					y++;
					continue;
				}

				if(x == off + 1 && y == off) {
					off++;
					y++;
				} else if(x == off && y == off) {
					y++;
				} else if(x == off && y == m - off - 1) {
					x++;
				} else if(x == n - off - 1 && y == m - off - 1) {
					y--;
				} else if(x == n - off - 1 && y == off) {
					x--;
				} else if(x == off) {
					y++;
				} else if(y == m - off - 1) {
					x++;
				} else if(x == n - off - 1) {
					y--;
				} else if(y == off) {
					x--;
				} else {
					System.out.println("I was wrong");
					break;
				}
			}

			for(int i = 0; i < n; i++)
				pw.println(new String(ans[i]));

		}

		pw.flush();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++)
				array[i] = new Integer(nextInt());
			return array;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public static int[] shuffle(int[] a) {
			int n = a.length;
			Random rand = new Random();
			for (int i = 0; i < n; i++) {
				int tmpIdx = rand.nextInt(n);
				int tmp = a[i];
				a[i] = a[tmpIdx];
				a[tmpIdx] = tmp;
			}
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


import java.util.*;
import java.io.*;

public class D_1255 {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt(), m = sc.nextInt();
			int c = sc.nextInt();

			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++)
				grid[i] = sc.next().toCharArray();
			int r = 0;
			for(int i = 0; i < n; i++)
				for(int j = 0; j < m; j++)
					if(grid[i][j] == 'R')
						r++;

			int v1 = r / c, v2 = r / c + 1;
			int c1 = v1 == 0 ? 0 : c - r % c, c2 = r % c;

			ArrayList<Character> list = new ArrayList<>();
			for(char i = '0'; i <= '9'; i++)
				list.add(i);
			for(char i = 'a'; i <= 'z'; i++)
				list.add(i);
			for(char i = 'A'; i <= 'Z'; i++)
				list.add(i);

			char[][] ans = new char[n][m];
			int x = 0, y = 0;
			int charCounter = 0, off = 0, tot = 0;
			int cur = 0;
			while(tot < n * m) {
				tot++;
				if(grid[x][y] == 'R') {
					ans[x][y] = list.get(charCounter);
					cur++;
					if(cur == v1 && c1 > 0) {
						c1--;
						cur = 0;
					} else if(cur == v2) {
						c2--;
						cur = 0;
					}

					if(cur == 0) {
						if(!(c1 == 0 && c2 == 0)) {
							charCounter++;
						}
					}
				} else {
					if(c1 == 0 && c2 == 0 && charCounter != c - 1)
						charCounter++;
					ans[x][y] = list.get(charCounter);
				}

				if(m == 1) {
					x++;
					continue;
				}

				if(n == 1) {
					y++;
					continue;
				}

				if(x == off + 1 && y == off) {
					off++;
					y++;
				} else if(x == off && y == off) {
					y++;
				} else if(x == off && y == m - off - 1) {
					x++;
				} else if(x == n - off - 1 && y == m - off - 1) {
					y--;
				} else if(x == n - off - 1 && y == off) {
					x--;
				} else if(x == off) {
					y++;
				} else if(y == m - off - 1) {
					x++;
				} else if(x == n - off - 1) {
					y--;
				} else if(y == off) {
					x--;
				} else {
					System.out.println("I was wrong");
					break;
				}
			}

			for(int i = 0; i < n; i++)
				pw.println(new String(ans[i]));

		}

		pw.flush();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++)
				array[i] = new Integer(nextInt());
			return array;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public static int[] shuffle(int[] a) {
			int n = a.length;
			Random rand = new Random();
			for (int i = 0; i < n; i++) {
				int tmpIdx = rand.nextInt(n);
				int tmp = a[i];
				a[i] = a[tmpIdx];
				a[tmpIdx] = tmp;
			}
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


import java.util.*;
import java.io.*;

public class D_1255 {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt(), m = sc.nextInt();
			int c = sc.nextInt();

			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++)
				grid[i] = sc.next().toCharArray();
			int r = 0;
			for(int i = 0; i < n; i++)
				for(int j = 0; j < m; j++)
					if(grid[i][j] == 'R')
						r++;

			int v1 = r / c, v2 = r / c + 1;
			int c1 = v1 == 0 ? 0 : c - r % c, c2 = r % c;

			ArrayList<Character> list = new ArrayList<>();
			for(char i = '0'; i <= '9'; i++)
				list.add(i);
			for(char i = 'a'; i <= 'z'; i++)
				list.add(i);
			for(char i = 'A'; i <= 'Z'; i++)
				list.add(i);

			char[][] ans = new char[n][m];
			int x = 0, y = 0;
			int charCounter = 0, off = 0, tot = 0;
			int cur = 0;
			while(tot < n * m) {
				tot++;
				if(grid[x][y] == 'R') {
					ans[x][y] = list.get(charCounter);
					cur++;
					if(cur == v1 && c1 > 0) {
						c1--;
						cur = 0;
					} else if(cur == v2) {
						c2--;
						cur = 0;
					}

					if(cur == 0) {
						if(!(c1 == 0 && c2 == 0)) {
							charCounter++;
						}
					}
				} else {
					if(c1 == 0 && c2 == 0 && charCounter != c - 1)
						charCounter++;
					ans[x][y] = list.get(charCounter);
				}

				if(m == 1) {
					x++;
					continue;
				}

				if(x == off + 1 && y == off) {
					off++;
					y++;
				} else if(x == off && y == off) {
					y++;
				} else if(x == off && y == m - off - 1) {
					x++;
				} else if(x == n - off - 1 && y == m - off - 1) {
					y--;
				} else if(x == n - off - 1 && y == off) {
					x--;
				} else if(x == off) {
					y++;
				} else if(y == m - off - 1) {
					x++;
				} else if(x == n - off - 1) {
					y--;
				} else if(y == off) {
					x--;
				} else {
					System.out.println("I was wrong");
					break;
				}
			}

			for(int i = 0; i < n; i++)
				pw.println(new String(ans[i]));

		}

		pw.flush();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++)
				array[i] = new Integer(nextInt());
			return array;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public static int[] shuffle(int[] a) {
			int n = a.length;
			Random rand = new Random();
			for (int i = 0; i < n; i++) {
				int tmpIdx = rand.nextInt(n);
				int tmp = a[i];
				a[i] = a[tmpIdx];
				a[tmpIdx] = tmp;
			}
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ProblemD {

    public static InputStream inputStream = System.in;

    public static OutputStream outputStream = System.out;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int t = Integer.parseInt(scanner.nextLine());

        for (int p = 0; p < t; p++) {
            String line = scanner.nextLine();
            String[] parts = line.split(" ");
            int l = Integer.parseInt(parts[0]);
            int r = Integer.parseInt(parts[1]);
            int k = Integer.parseInt(parts[2]);

            int [][] matrix = new int[101][101];
            int sumOfRice = 0;
            for (int i = 0; i < l; i++) {
                line = scanner.nextLine();
                for (int j = 0; j < r; j++) {
                    if (line.charAt(j) == 'R') {
                        matrix[i][j] = 1;
                        sumOfRice++;
                    }
                }
            }

            List<Pair<Character, Integer>> characters = getCharacters(k, sumOfRice);
            int index = 0;

            char [][] ans = new char[101][101];

            for (int i = 0; i < l; i++) {
                if (i % 2 == 0) {
                    for (int j = 0; j < r; j++) {
                        ans[i][j] = characters.get(index).first;
                        if (matrix[i][j] == 1) {
                            characters.get(index).second--;
                        }
                        if (characters.get(index).second == 0) {
                            index++;
                        }
                    }
                } else {
                    for (int j = r - 1; j >= 0; j--) {
                        ans[i][j] = characters.get(index).first;
                        if (matrix[i][j] == 1) {
                            characters.get(index).second--;
                        }
                        if (characters.get(index).second == 0 && index < k - 1) {
                            index++;
                        }
                    }
                }
            }

            for (int i = 0; i < l; i++) {
                for (int j = 0; j < r; j++) {
                    out.print(ans[i][j]);
                }
                out.println();
            }

        }

        out.flush();
    }

    private static List<Pair<Character, Integer>> getCharacters(int k, int sumOfRice) {
        char c = '0';

        List<Pair<Character, Integer>> list = new ArrayList<>();

        for (int i = 0; i < sumOfRice % k; i++) {
            list.add(new Pair<>(c, sumOfRice / k + 1));
            if (c == '9') {
                c = 'a';
            } else if (c == 'z') {
                c = 'A';
            } else {
                c++;
            }
        }
        for (int i = list.size(); i < k; i++) {
            list.add(new Pair<>(c, sumOfRice / k));
            if (c == '9') {
                c = 'a';
            } else if (c == 'z') {
                c = 'A';
            } else {
                c++;
            }
        }
        return list;
    }

    private static class Pair<F, S> {

        private F first;

        private S second;

        public Pair() {}

        public Pair(F first, S second) {
            this.first = first;
            this.second = second;
        }
    }
}


import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ProblemD {

    public static InputStream inputStream = System.in;

    public static OutputStream outputStream = System.out;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int t = Integer.parseInt(scanner.nextLine());

        for (int p = 0; p < t; p++) {
            String line = scanner.nextLine();
            String[] parts = line.split(" ");
            int l = Integer.parseInt(parts[0]);
            int r = Integer.parseInt(parts[1]);
            int k = Integer.parseInt(parts[2]);

            int [][] matrix = new int[101][101];
            int sumOfRice = 0;
            for (int i = 0; i < l; i++) {
                line = scanner.nextLine();
                for (int j = 0; j < r; j++) {
                    if (line.charAt(j) == 'R') {
                        matrix[i][j] = 1;
                        sumOfRice++;
                    }
                }
            }

            List<Pair<Character, Integer>> characters = getCharacters(k, sumOfRice);
            int index = 0;

            char [][] ans = new char[101][101];

            for (int i = 0; i < l; i++) {
                if (i % 2 == 0) {
                    for (int j = 0; j < r; j++) {
                        ans[i][j] = characters.get(index).first;
                        if (matrix[i][j] == 1) {
                            characters.get(index).second--;
                        }
                        if (characters.get(index).second == 0) {
                            index++;
                        }
                    }
                } else {
                    for (int j = r - 1; j >= 0; j--) {
                        ans[i][j] = characters.get(index).first;
                        if (matrix[i][j] == 1) {
                            characters.get(index).second--;
                        }
                        if (characters.get(index).second == 0) {
                            index++;
                        }
                    }
                }
            }

            for (int i = 0; i < l; i++) {
                for (int j = 0; j < r; j++) {
                    out.print(ans[i][j]);
                }
                out.println();
            }

        }

        out.flush();
    }

    private static List<Pair<Character, Integer>> getCharacters(int k, int sumOfRice) {
        char c = '0';

        List<Pair<Character, Integer>> list = new ArrayList<>();

        for (int i = 0; i < sumOfRice % k; i++) {
            list.add(new Pair<>(c, sumOfRice / k + 1));
            if (c == '9') {
                c = 'a';
            } else if (c == 'z') {
                c = 'A';
            } else {
                c++;
            }
        }
        for (int i = list.size(); i < k; i++) {
            list.add(new Pair<>(c, sumOfRice / k));
            if (c == '9') {
                c = 'a';
            } else if (c == 'z') {
                c = 'A';
            } else {
                c++;
            }
        }
        return list;
    }

    private static class Pair<F, S> {

        private F first;

        private S second;

        public Pair() {}

        public Pair(F first, S second) {
            this.first = first;
            this.second = second;
        }
    }
}


import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ProblemD {

    public static InputStream inputStream = System.in;

    public static OutputStream outputStream = System.out;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int t = Integer.parseInt(scanner.nextLine());

        for (int p = 0; p < t; p++) {
            String line = scanner.nextLine();
            String[] parts = line.split(" ");
            int l = Integer.parseInt(parts[0]);
            int r = Integer.parseInt(parts[1]);
            int k = Integer.parseInt(parts[2]);

            int [][] matrix = new int[101][101];
            int sumOfRice = 0;
            for (int i = 0; i < l; i++) {
                line = scanner.nextLine();
                for (int j = 0; j < r; j++) {
                    if (line.charAt(j) == 'R') {
                        matrix[i][j] = 1;
                        sumOfRice++;
                    }
                }
            }

            List<Pair<Character, Integer>> characters = getCharacters(k, sumOfRice);
            int index = 0;

            char [][] ans = new char[101][101];

            for (int i = 0; i < l; i++) {
                if (i % 2 == 0) {
                    for (int j = 0; j < r; j++) {
                        ans[i][j] = characters.get(index).first;
                        if (matrix[i][j] == 1) {
                            characters.get(index).second--;
                        }
                        if (characters.get(index).second == 0 && index < k - 1) {
                            index++;
                        }
                    }
                } else {
                    for (int j = r - 1; j >= 0; j--) {
                        ans[i][j] = characters.get(index).first;
                        if (matrix[i][j] == 1) {
                            characters.get(index).second--;
                        }
                        if (characters.get(index).second == 0 && index < k - 1) {
                            index++;
                        }
                    }
                }
            }

            for (int i = 0; i < l; i++) {
                for (int j = 0; j < r; j++) {
                    out.print(ans[i][j]);
                }
                out.println();
            }

        }

        out.flush();
    }

    private static List<Pair<Character, Integer>> getCharacters(int k, int sumOfRice) {
        char c = '0';

        List<Pair<Character, Integer>> list = new ArrayList<>();

        for (int i = 0; i < sumOfRice % k; i++) {
            list.add(new Pair<>(c, sumOfRice / k + 1));
            if (c == '9') {
                c = 'a';
            } else if (c == 'z') {
                c = 'A';
            } else {
                c++;
            }
        }
        for (int i = list.size(); i < k; i++) {
            list.add(new Pair<>(c, sumOfRice / k));
            if (c == '9') {
                c = 'a';
            } else if (c == 'z') {
                c = 'A';
            } else {
                c++;
            }
        }
        return list;
    }

    private static class Pair<F, S> {

        private F first;

        private S second;

        public Pair() {}

        public Pair(F first, S second) {
            this.first = first;
            this.second = second;
        }
    }
}


import java.io.*;
import java.util.*;
public class Abc
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int t=in.nextInt();
		while(t-->0)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			int k=in.nextInt();
			int n_rice = 0;
			int ar[][]=new int[n][m];
			for(int i=0;i<n;i++)
			{
				String s=in.next();
				for(int j=0;j<m;j++)
				{
					char ch=s.charAt(j);
					if(ch=='.')
					{
						ar[i][j] = 0;
					}
					else
					{
						ar[i][j] = 1;
						n_rice++;
					}
				}
			}
			int br[][]=new int[n][m];
			count=0;
			c_no = 1;
			rice=0;
			rice = n_rice/k;
			if(1 <= n_rice%k)
				rice+=1;
			//System.out.println("C_no: "+c_no+" rice: "+rice+" count: "+count);
			func(ar,br,0,0,n,m,n_rice,k);

			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					char ch;
					if(br[i][j]<=26)
						ch=(char)(br[i][j]+'a'-1);
					else if(br[i][j]<=52)
						ch=(char)(br[i][j]-26+'A'-1);
					else
						ch=(char)(br[i][j]-52+'0'-1);
					System.out.print(ch);
				}
				System.out.println();
			}

		}
	}
	static int count = 0,c_no = 1,rice=0;
	public static void func(int ar[][],int br[][],int x,int y,int n,int m,int n_rice,int k)
	{
		if(x>=n || y>=m || x<0 || y<0 || br[x][y] != 0)
		{
			return;
		}
		if(count == rice && c_no < k)
		{
			count=0;
			//System.out.println("Count = "+" Rice = "+rice+" c_no "+c_no);
			c_no ++;
			rice = n_rice/k;
			if(c_no <= n_rice%k)
			{
				rice+=1;
			}
		}
		/*System.out.println("Chicken " +c_no );
		for(int i=0;i<n;i++)
		{
			System.out.println(Arrays.toString(br[i]));
		}*/
		br[x][y] = c_no;
		if(ar[x][y] == 1)
		{
			count++;
		}
		func(ar,br,x,y+1,n,m,n_rice,k);
		func(ar,br,x+1,y,n,m,n_rice,k);
		func(ar,br,x,y-1,n,m,n_rice,k);
		func(ar,br,x-1,y,n,m,n_rice,k);
	}
}


import java.io.*;
import java.util.*;
public class Abc
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int t=in.nextInt();
		while(t-->0)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			int k=in.nextInt();
			int n_rice = 0;
			int ar[][]=new int[n][m];
			for(int i=0;i<n;i++)
			{
				String s=in.next();
				for(int j=0;j<m;j++)
				{
					char ch=s.charAt(j);
					if(ch=='.')
					{
						ar[i][j] = 0;
					}
					else
					{
						ar[i][j] = 1;
						n_rice++;
					}
				}
			}
			int br[][]=new int[n][m];
			int c_no = 1;
			Outer :for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					int rice = n_rice/k;
					if(c_no <= n_rice%k)
					{
						rice += 1;
					}
					if(br[i][j]==0)
					{
						count=0;
						//System.out.println("Chicken no "+c_no);
						func(ar,br,i,j,rice,c_no,n,m);
						c_no++;
						if(c_no>k)
						{
							break Outer;
						}
					}
				}
			}
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					if(br[i][j]==0)
						br[i][j]=k;
				}
			}
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					char ch;
					if(br[i][j]<=26)
						ch=(char)(br[i][j]+'a'-1);
					else if(br[i][j]<=52)
						ch=(char)(br[i][j]-26+'A'-1);
					else
						ch=(char)(br[i][j]-52+'0'-1);
					System.out.print(ch);
				}
				System.out.println();
			}
		}
	}
	static int count =0;
	public static void func(int ar[][],int br[][],int x,int y,int rice, int c_no,int n,int m)
	{

		if(count >= rice || x>=n || y>=m || br[x][y] != 0)
		{
			return;
		}
		br[x][y] = c_no;
		/*for(int i=0;i<n;i++)
		{
			System.out.println(Arrays.toString(br[i]));
		}
		System.out.println();*/
		if(ar[x][y] == 1)
		{
			count++;
		}
		func(ar,br,x+1,y,rice,c_no,n,m);
		func(ar,br,x,y+1,rice,c_no,n,m);
	}
}


import java.io.*;
import java.util.*;
public class Abc
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int t=in.nextInt();
		while(t-->0)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			int k=in.nextInt();
			int n_rice = 0;
			int ar[][]=new int[n][m];
			for(int i=0;i<n;i++)
			{
				String s=in.next();
				for(int j=0;j<m;j++)
				{
					char ch=s.charAt(j);
					if(ch=='.')
					{
						ar[i][j] = 0;
					}
					else
					{
						ar[i][j] = 1;
						n_rice++;
					}
				}
			}
			int br[][]=new int[n][m];
			int c_no = 1;
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					int rice = n_rice/k;
					if(c_no <= n_rice%k)
					{
						rice += 1;
					}
					if(br[i][j]==0)
					{
						func(ar,br,i,j,rice,0,c_no,n,m);
						c_no++;
					}
				}
			}
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					char ch;
					if(br[i][j]<=26)
						ch=(char)(br[i][j]+'a'-1);
					else if(br[i][j]<=52)
						ch=(char)(br[i][j]-26+'A'-1);
					else
						ch=(char)(br[i][j]-52+'0'-1);
					System.out.print(ch);
				}
				System.out.println();
			}
		}
	}
	public static void func(int ar[][],int br[][],int x,int y,int rice, int count,int c_no,int n,int m)
	{

		if(count >= rice || x>=n || y>=m || br[x][y] != 0)
		{
			return;
		}

		br[x][y] = c_no;
		if(ar[x][y]==1)
		{
			count++;
		}
		func(ar,br,x+1,y,rice,count,c_no,n,m);
		func(ar,br,x,y+1,rice,count,c_no,n,m);
	}
}


import java.io.*;
import java.util.*;
public class Abc
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int t=in.nextInt();
		while(t-->0)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			int k=in.nextInt();
			int n_rice = 0;
			int ar[][]=new int[n][m];
			for(int i=0;i<n;i++)
			{
				String s=in.next();
				for(int j=0;j<m;j++)
				{
					char ch=s.charAt(j);
					if(ch=='.')
					{
						ar[i][j] = 0;
					}
					else
					{
						ar[i][j] = 1;
						n_rice++;
					}
				}
			}
			int br[][]=new int[n][m];
			int c_no = 1;
			Outer :for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					int rice = n_rice/k;
					if(c_no <= n_rice%k)
					{
						rice += 1;
					}
					if(br[i][j]==0)
					{
						count=0;
						//System.out.println("Chicken no "+c_no);
						func(ar,br,i,j,rice,c_no,n,m);
						c_no++;
						if(c_no>k)
						{
							break Outer;
						}
					}
				}
			}
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					if(br[i][j]==0)
						br[i][j]=k;
				}
			}
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					char ch;
					if(br[i][j]<=26)
						ch=(char)(br[i][j]+'a'-1);
					else if(br[i][j]<=52)
						ch=(char)(br[i][j]-26+'A'-1);
					else
						ch=(char)(br[i][j]-52+'0'-1);
					System.out.print(ch);
				}
				System.out.println();
			}
		}
	}
	static int count =0;
	public static void func(int ar[][],int br[][],int x,int y,int rice, int c_no,int n,int m)
	{

		if(count >= rice || x>=n || y>=m || x<0 || y<0 || br[x][y] != 0)
		{
			return;
		}
		br[x][y] = c_no;
		/*for(int i=0;i<n;i++)
		{
			System.out.println(Arrays.toString(br[i]));
		}
		System.out.println();*/
		if(ar[x][y] == 1)
		{
			count++;
		}
		func(ar,br,x,y+1,rice,c_no,n,m);
		func(ar,br,x+1,y,rice,c_no,n,m);
		func(ar,br,x,y-1,rice,c_no,n,m);
		func(ar,br,x-1,y,rice,c_no,n,m);
	}
}


import java.io.*;
import java.util.*;
public class Abc
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int t=in.nextInt();
		while(t-->0)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			int k=in.nextInt();
			int n_rice = 0;
			int ar[][]=new int[n][m];
			for(int i=0;i<n;i++)
			{
				String s=in.next();
				for(int j=0;j<m;j++)
				{
					char ch=s.charAt(j);
					if(ch=='.')
					{
						ar[i][j] = 0;
					}
					else
					{
						ar[i][j] = 1;
						n_rice++;
					}
				}
			}
			int br[][]=new int[n][m];
			int c_no = 1;
			Outer :for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					int rice = n_rice/k;
					if(c_no <= n_rice%k)
					{
						rice += 1;
					}
					if(br[i][j]==0)
					{
						count=0;
						//System.out.println("Chicken no "+c_no);
						func(ar,br,i,j,rice,c_no,n,m);
						c_no++;
						if(c_no>k)
						{
							break Outer;
						}
					}
				}
			}
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					if(br[i][j]==0)
						br[i][j]=k;
				}
			}
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					char ch;
					if(br[i][j]<=26)
						ch=(char)(br[i][j]+'a'-1);
					else if(br[i][j]<=52)
						ch=(char)(br[i][j]-26+'A'-1);
					else
						ch=(char)(br[i][j]-52+'0'-1);
					System.out.print(ch);
				}
				System.out.println();
			}
		}
	}
	static int count =0;
	public static void func(int ar[][],int br[][],int x,int y,int rice, int c_no,int n,int m)
	{

		if(count >= rice || x>=n || y>=m || br[x][y] != 0)
		{
			return;
		}
		br[x][y] = c_no;
		/*for(int i=0;i<n;i++)
		{
			System.out.println(Arrays.toString(br[i]));
		}
		System.out.println();*/
		if(ar[x][y] == 1)
		{
			count++;
		}
		func(ar,br,x,y+1,rice,c_no,n,m);
		func(ar,br,x+1,y,rice,c_no,n,m);
	}
}


import java.io.*;
import java.util.*;
public class Abc
{
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int t=in.nextInt();
		while(t-->0)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			int k=in.nextInt();
			int n_rice = 0;
			int ar[][]=new int[n][m];
			for(int i=0;i<n;i++)
			{
				String s=in.next();
				for(int j=0;j<m;j++)
				{
					char ch=s.charAt(j);
					if(ch=='.')
					{
						ar[i][j] = 0;
					}
					else
					{
						ar[i][j] = 1;
						n_rice++;
					}
				}
			}
			int br[][]=new int[n][m];
			int c_no = 1;
			count=0;
			c_no=1;
			rice = n_rice/k;
			if(1 <= n_rice%k)
				rice+=1;
			func(ar,br,0,0,n,m,n_rice,k);

			for(int i=0;i<n;i++)
			{
				for(int j=0;j<m;j++)
				{
					char ch;
					if(br[i][j]<=26)
						ch=(char)(br[i][j]+'a'-1);
					else if(br[i][j]<=52)
						ch=(char)(br[i][j]+'A'-1);
					else
						ch=(char)(br[i][j]+'0'-1);
					System.out.print(ch);
				}
				System.out.println();
			}

		}
	}
	static int count =0,c_no=1,rice=0;
	public static void func(int ar[][],int br[][],int x,int y,int n,int m,int n_rice,int k)
	{
		if(x>=n || y>=m || x<0 || y<0 || br[x][y] != 0)
		{
			return;
		}
		if(count == rice && c_no < k)
		{
			count=0;
			c_no++;
			rice = n_rice/k;
			if(c_no <= n_rice%k)
			{
				rice+=1;
			}
		}
		br[x][y] = c_no;
		if(ar[x][y] == 1)
		{
			count++;
		}
		func(ar,br,x,y+1,n,m,n_rice,k);
		func(ar,br,x+1,y,n,m,n_rice,k);
		func(ar,br,x,y-1,n,m,n_rice,k);
		func(ar,br,x-1,y,n,m,n_rice,k);
	}
}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class Solution implements Runnable{
    static class pair implements Comparable
    {
        int f;
        int s;
        pair(int fi,int se)
        {
            f=fi;
            s=se;
        }
        public int compareTo(Object o)//ascending order
        {
            pair pr=(pair)o;
            if(s>pr.s)
                return 1;
            if(s==pr.s)
            {
                if(f>pr.f)
                    return 1;
                else
                    return -1;
            }
            else
                return -1;
        }
        public boolean equals(Object o)
        {
            pair ob=(pair)o;
            if(o!=null)
            {
                if((ob.f==this.f)&&(ob.s==this.s))
                    return true;
            }
            return false;
        }
        public int hashCode()
        {
            return (this.f+" "+this.s).hashCode();
        }
    }
    public class triplet implements Comparable
    {
        int f;
        int s;
        int t;
        triplet(int f,int s,int t)
        {
            this.f=f;
            this.s=s;
            this.t=t;
        }
        public boolean equals(Object o)
        {
            triplet ob=(triplet)o;
            int ff;
            int ss;
            double tt;
            if(o!=null)
            {
                ff=ob.f;
                ss=ob.s;
                tt=ob.t;
                if((ff==this.f)&&(ss==this.s)&&(tt==this.t))
                    return true;
            }
            return false;
        }
        public int hashCode()
        {
            return (this.f+" "+this.s+" "+this.t).hashCode();
        }
        public int compareTo(Object o)//ascending order
        {
            triplet tr=(triplet)o;
            if(t>tr.t)
                return 1;
            else
                return -1;
        }
    }
    public class quad implements Comparable
    {
        int x,y,rank,white;
        quad(int xx,int yy,int rankk,int whitee)
        {
            x=xx;
            y=yy;
            rank=rankk;
            white=whitee;
        }
        public int compareTo(Object o)
        {
            quad q=(quad)o;
            if(rank>q.rank)
                return -1;
            else if(rank<q.rank)
                return 1;
            else
            {
                if(white < q.white)
                    return 1;
                else
                    return -1;
            }
        }
    }
    void merge1(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i]<=R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort1(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort1(arr, l, m);
            sort1(arr , m+1, r);
            merge1(arr, l, m, r);
        }
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new Solution(),"Solution",1<<27).start();
    }
    public void run()
    {
        try
        {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int t=in.ni();
            while(t--!=0)
            {
                int n=in.ni();
                int m=in.ni();
                int k=in.ni();
                char c[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x',
                'y','z','1','2','3','4','5','6','7','8','9','0','A','B','C','D','E','F','G','H','I','J','K','L','M','N',
                'O','P','Q','R','S','T','U','V','W','X','Y','Z'};
                int x=0;
                int a[][]=new int[n+1][m+1];
                for(int i=1;i<=n;i++)
                {
                    String s=in.nextLine();
                    for(int j=0;j<m;j++)
                    {
                        a[i][j + 1] = (s.charAt(j) == '.') ? 0 : 1;
                        x+=a[i][j+1];
                    }
                }
                int p=x/k;
                k--;
                x-=p;
                int y=0;
                char ans[][]=new char[n+1][m+1];
                for(int i=1;i<=n;i++)
                {
                    if(i%2==1)
                    {
                        for(int j=1;j<=m;j++)
                        {
                            p-=a[i][j];
                            ans[i][j]=c[y];
                            if(p==0)
                            {
                                if(k==0)
                                    continue;
                                p=x/k;
                                k--;
                                x-=p;
                                y++;
                            }
                        }
                    }
                    else
                    {
                        for(int j=m;j>=1;j--)
                        {
                            p-=a[i][j];
                            ans[i][j]=c[y];
                            if(p==0)
                            {
                                if(k==0)
                                    continue;
                                p=x/k;
                                k--;
                                x-=p;
                                y++;
                            }
                        }
                    }
                }
                for(int i=1;i<=n;i++)
                {
                    for(int j=1;j<=m;j++)
                        out.print(ans[i][j]+" ");
                    out.println();
                }
            }
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class Solution implements Runnable{
    static class pair implements Comparable
    {
        int f;
        int s;
        pair(int fi,int se)
        {
            f=fi;
            s=se;
        }
        public int compareTo(Object o)//ascending order
        {
            pair pr=(pair)o;
            if(s>pr.s)
                return 1;
            if(s==pr.s)
            {
                if(f>pr.f)
                    return 1;
                else
                    return -1;
            }
            else
                return -1;
        }
        public boolean equals(Object o)
        {
            pair ob=(pair)o;
            if(o!=null)
            {
                if((ob.f==this.f)&&(ob.s==this.s))
                    return true;
            }
            return false;
        }
        public int hashCode()
        {
            return (this.f+" "+this.s).hashCode();
        }
    }
    public class triplet implements Comparable
    {
        int f;
        int s;
        int t;
        triplet(int f,int s,int t)
        {
            this.f=f;
            this.s=s;
            this.t=t;
        }
        public boolean equals(Object o)
        {
            triplet ob=(triplet)o;
            int ff;
            int ss;
            double tt;
            if(o!=null)
            {
                ff=ob.f;
                ss=ob.s;
                tt=ob.t;
                if((ff==this.f)&&(ss==this.s)&&(tt==this.t))
                    return true;
            }
            return false;
        }
        public int hashCode()
        {
            return (this.f+" "+this.s+" "+this.t).hashCode();
        }
        public int compareTo(Object o)//ascending order
        {
            triplet tr=(triplet)o;
            if(t>tr.t)
                return 1;
            else
                return -1;
        }
    }
    public class quad implements Comparable
    {
        int x,y,rank,white;
        quad(int xx,int yy,int rankk,int whitee)
        {
            x=xx;
            y=yy;
            rank=rankk;
            white=whitee;
        }
        public int compareTo(Object o)
        {
            quad q=(quad)o;
            if(rank>q.rank)
                return -1;
            else if(rank<q.rank)
                return 1;
            else
            {
                if(white < q.white)
                    return 1;
                else
                    return -1;
            }
        }
    }
    void merge1(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i]<=R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort1(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort1(arr, l, m);
            sort1(arr , m+1, r);
            merge1(arr, l, m, r);
        }
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new Solution(),"Solution",1<<27).start();
    }
    public void run()
    {
        try
        {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int t=in.ni();
            while(t--!=0)
            {
                int n=in.ni();
                int m=in.ni();
                int k=in.ni();
                char c[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x',
                'y','z','1','2','3','4','5','6','7','8','9','0','A','B','C','D','E','F','G','H','I','J','K','L','M','N',
                'O','P','Q','R','S','T','U','V','W','X','Y','Z'};
                int x=0;
                int a[][]=new int[n+1][m+1];
                for(int i=1;i<=n;i++)
                {
                    String s=in.nextLine();
                    for(int j=0;j<m;j++)
                    {
                        a[i][j + 1] = (s.charAt(j) == '.') ? 0 : 1;
                        x+=a[i][j+1];
                    }
                }
                int p=x/k;
                k--;
                x-=p;
                int y=0;
                char ans[][]=new char[n+1][m+1];
                for(int i=1;i<=n;i++)
                {
                    if(i%2==1)
                    {
                        for(int j=1;j<=m;j++)
                        {
                            p-=a[i][j];
                            ans[i][j]=c[y];
                            if(p==0)
                            {
                                if(k==0)
                                    continue;
                                p=x/k;
                                k--;
                                x-=p;
                                y++;
                            }
                        }
                    }
                    else
                    {
                        for(int j=m;j>=1;j--)
                        {
                            p-=a[i][j];
                            ans[i][j]=c[y];
                            if(p==0)
                            {
                                if(k==0)
                                    continue;
                                p=x/k;
                                k--;
                                x-=p;
                                y++;
                            }
                        }
                    }
                }
                for(int i=1;i<=n;i++)
                {
                    for(int j=1;j<=m;j++)
                        out.print(ans[i][j]);
                    out.println();
                }
            }
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
using namespace std;
main()
{
  fast;
  ll t,r,c,chick;
  vector<char> vec;
  for(char i='0';i<='9';++i) vec.push_back(i);
  for(char i='a';i<='z';++i) vec.push_back(i);
  for(char i='A';i<='Z';++i) vec.push_back(i);
  vec.push_back(0);
  vec.push_back(1);
  cin>>t;
  vector<char> final;
  while(t--)
  {
    ll cnt=0,rc,rem;
    cin>>r>>c>>chick;
    char arr[r][c],ja[r+5][c+5];
    for(ll i=0;i<r;++i) for(ll j=0;j<c;++j)
    {
      cin>>arr[i][j];
      if(arr[i][j]=='R') cnt++;
    }
    rc=cnt/chick;
    rem=cnt%chick;
    int k=0;
    for(ll i=0;i<rem;++i) for(ll j=0;j<rc+1;++j) final.push_back(vec[i]);
    for(ll i=rem;i<rc*chick+rem;++i) for(ll j=0;j<rc;++j) final.push_back(vec[i]);
    for(ll i=0;i<r;++i)
    {
      if(!(i%2))
        for(ll j=0;j<c;++j)
        {
          if(k==cnt) k=cnt-1;
          if(arr[i][j]=='R')
          {
           ja[i][j]=final[k];
            k++;
          }
          else ja[i][j]=final[k];
        }
      else
      {
      for(ll j=c-1;j>=0;--j)
       {
         if(k==cnt) k=cnt-1;
          if(arr[i][j]=='R')
          {
            ja[i][j]=final[k];
            k++;
          }
          else ja[i][j]=final[k];
       }
      }
    }
    final.clear();
     for(ll i=0;i<r;++i){ for(ll j=0;j<c;++j) cout<<ja[i][j];cout<<endl;}
  }
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
using namespace std;
main()
{
  ll t,r,c,chick;
  vector<char> vec;
  for(char i='0';i<='9';++i) vec.push_back(i);
  for(char i='a';i<='z';++i) vec.push_back(i);
  for(char i='A';i<='Z';++i) vec.push_back(i);
  cin>>t;
  vector<char> final;
  while(t--)
  {
    ll cnt=0,rc,rem;
    cin>>r>>c>>chick;
    char arr[r][c];
    for(ll i=0;i<r;++i) for(ll j=0;j<c;++j)
    {
      cin>>arr[i][j];
      if(arr[i][j]=='R') cnt++;
    }
    rc=cnt/chick;
    rem=cnt%chick;
    int k=0;
    for(ll i=0;i<rem;++i) for(ll j=0;j<rc+1;++j) final.push_back(vec[i]);
    for(ll i=rem;i<rc*cnt+rem;++i) for(ll j=0;j<rc;++j) final.push_back(vec[i]);
    for(ll i=0;i<r;++i)
    {
      if(!(i%2))
        for(ll j=0;j<c;++j)
        {
          if(k==cnt) k=cnt-1;
          if(k<0) k=0;
          if(arr[i][j]=='R')
          {
           arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
        }
      else
      {
      for(ll j=c-1;j>=0;--j)
       {
         if(k==cnt) k=cnt-1;
         if(k<0) k=0;
          if(arr[i][j]=='R')
          {
            arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
       }
      }
    }
    final.clear();
     for(ll i=0;i<r;++i){ for(ll j=0;j<c;++j) cout<<arr[i][j];cout<<endl;}
  }
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
using namespace std;
main()
{
  ll t,r,c,chick;
  vector<char> vec;
  for(char i='0';i<='9';++i) vec.push_back(i);
  for(char i='a';i<='z';++i) vec.push_back(i);
  for(char i='A';i<='Z';++i) vec.push_back(i);
  cin>>t;
  vector<char> final;
  while(t--)
  {
    ll cnt=0,rc,rem;
    cin>>r>>c>>chick;
    char arr[r][c];
    for(ll i=0;i<r;++i) for(ll j=0;j<c;++j)
    {
      cin>>arr[i][j];
      if(arr[i][j]=='R') cnt++;
    }
    rc=cnt/chick;
    rem=cnt%chick;
    int k=0;
    for(ll i=0;i<rem;++i) for(ll j=0;j<rc+1;++j) final.push_back(vec[i]);
    for(ll i=rem;i<rc*cnt+rem;++i) for(ll j=0;j<rc;++j) final.push_back(vec[i]);
    for(ll i=0;i<r;++i)
    {
      if(k>cnt) k=cnt;
      if(!(i%2))
        for(ll j=0;j<c;++j)
        {
          if(k==cnt) k=cnt-1;
          if(arr[i][j]=='R')
          {
           arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
        }
      else
      {
      for(ll j=c-1;j>=0;--j)
       {
         if(k==cnt) k=cnt-1;
          if(arr[i][j]=='R')
          {
            arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
       }
      }
    }
    final.clear();
     for(ll i=0;i<r;++i){ for(ll j=0;j<c;++j) cout<<arr[i][j];cout<<endl;}
  }
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
using namespace std;
main()
{
  ll t,r,c,chick;
  vector<char> vec;
  for(char i='0';i<='9';++i) vec.push_back(i);
  for(char i='a';i<='z';++i) vec.push_back(i);
  for(char i='A';i<='Z';++i) vec.push_back(i);
  vec.push_back(0);
  vec.push_back(1);
  cin>>t;
  vector<char> final;
  while(t--)
  {
    ll cnt=0,rc,rem;
    cin>>r>>c>>chick;
    char arr[r][c],ja[r+5][c+5];
    for(ll i=0;i<r;++i) for(ll j=0;j<c;++j)
    {
      cin>>arr[i][j];
      if(arr[i][j]=='R') cnt++;
    }
    rc=cnt/chick;
    rem=cnt%chick;
    int k=0;
    for(ll i=0;i<rem;++i) for(ll j=0;j<rc+1;++j) final.push_back(vec[i]);
    for(ll i=rem;i<rc*chick+rem;++i) for(ll j=0;j<rc;++j) final.push_back(vec[i]);
    for(ll i=0;i<r;++i)
    {
      if(!(i%2))
        for(ll j=0;j<c;++j)
        {
          if(k==cnt) k=cnt-1;
          if(arr[i][j]=='R')
          {
           ja[i][j]=final[k];
            k++;
          }
          else ja[i][j]=final[k];
        }
      else
      {
      for(ll j=c-1;j>=0;--j)
       {
         if(k==cnt) k=cnt-1;
          if(arr[i][j]=='R')
          {
            ja[i][j]=final[k];
            k++;
          }
          else ja[i][j]=final[k];
       }
      }
    }
    final.clear();
     for(ll i=0;i<r;++i){ for(ll j=0;j<c;++j) cout<<ja[i][j];cout<<endl;}
  }
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
using namespace std;
main()
{
  ll t,r,c,chick;
  vector<char> vec;
  for(char i='0';i<='9';++i) vec.push_back(i);
  for(char i='a';i<='z';++i) vec.push_back(i);
  for(char i='A';i<='Z';++i) vec.push_back(i);
  cin>>t;
  vector<char> final;
  while(t--)
  {
    ll cnt=0,rc,rem;
    cin>>r>>c>>chick;
    char arr[r][c];
    for(ll i=0;i<r;++i) for(ll j=0;j<c;++j)
    {
      cin>>arr[i][j];
      if(arr[i][j]=='R') cnt++;
    }
    rc=cnt/chick;
    rem=cnt%chick;
    int k=0;
    for(ll i=0;i<rem;++i) for(ll j=0;j<rc+1;++j) final.push_back(vec[i]);
    for(ll i=rem;i<rc*cnt+rem;++i) for(ll j=0;j<rc;++j) final.push_back(vec[i]);
  //  cout<<rem<<endl<<rc<<endl;
    for(ll i=0;i<r;++i)
    {
      if(k>chick) k=chick;
      if(!(i%2))
        for(ll j=0;j<c;++j)
        {
          if(arr[i][j]=='R')
          {
           arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
        }
      else
      {
      for(ll j=c-1;j>=0;--j)
       {
          if(arr[i][j]=='R')
          {
            arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
       }
      }
    }
    final.clear();
     for(ll i=0;i<r;++i){ for(ll j=0;j<c;++j) cout<<arr[i][j];cout<<endl;}
  }
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long int
using namespace std;
main()
{
  ll t,r,c,chick;
  vector<char> vec;
  for(char i='0';i<'9';++i) vec.push_back(i);
  for(char i='a';i<'z';++i) vec.push_back(i);
  for(char i='A';i<'Z';++i) vec.push_back(i);
  cin>>t;
  vector<char> final;
  while(t--)
  {
    ll cnt=0,rc,rem;
    cin>>r>>c>>chick;
    char arr[r][c];
    for(ll i=0;i<r;++i) for(ll j=0;j<c;++j)
    {
      cin>>arr[i][j];
      if(arr[i][j]=='R') cnt++;
    }
    rc=cnt/chick;
    rem=cnt%chick;
    int k=0;
    for(ll i=0;i<rem;++i) for(ll j=0;j<rc+1;++j) final.push_back(vec[i]);
    for(ll i=rem;i<rc*cnt+rem;++i) for(ll j=0;j<rc;++j) final.push_back(vec[i]);
   // cout<<rem<<endl<<rc<<endl;
    for(ll i=0;i<r;++i)
    {
      if(!(i%2))
        for(ll j=0;j<c;++j)
        {
          if(arr[i][j]=='R')
          {
           arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
        }
      else
      {
      for(ll j=c-1;j>=0;--j)
       {
          if(arr[i][j]=='R')
          {
            arr[i][j]=final[k];
            k++;
          }
          else arr[i][j]=final[k];
       }
      }
    }
    //final.clear();
     for(ll i=0;i<r;++i){ for(ll j=0;j<c;++j) cout<<arr[i][j];cout<<endl;}
  }
}


k = int(input())
nn = input()
ll = [0 for i in range(10)]
n = map(int,nn)
ssum = 0
for i in n:
	ssum = ssum + i
	ll[i] = ll[i] + 1
if ssum >= k:
	print('0')
else:
	val = k - ssum
	cnt = 0
	i = 1
	while(val > 0):
		if(ll[i] != 0):
			val = val - (9 - i)
			cnt = cnt + 1
		else:
			i = i + 1
	print(cnt)


k = int(input())
nn = input()
ll = [0 for i in range(10)]
n = map(int,nn)
ssum = 0
for i in n:
	ssum = ssum + i
	ll[i] = ll[i] + 1
if ssum >= k:
	print('0')
else:
	val = k - ssum
	cnt = 0
	i = 1
	while(val > 0):
		if(ll[i] != 0):
			val = val - (9 - i)
			cnt = cnt + 1
			ll[i] = ll[i] - 1
		else:
			i = i + 1
	print(cnt)


k = int(input())
nn = input()
ll = [0 for i in range(10)]
n = map(int,nn)
ssum = 0
for i in n:
	ssum = ssum + i
	ll[i] = ll[i] + 1
if ssum >= k:
	print('0')
else:
	val = k - ssum
	cnt = 0
	i = 0
	while(val > 0):
		if(ll[i] > 0):
			val = val - (9 - i)
			cnt = cnt + 1
			ll[i] = ll[i] - 1
		else:
			i = i + 1
	print(cnt)


import sys
import math

def countDigits(n):
	digits = []
	for i in range(10):
		digits.append(n.count(str(i)))
	return digits

def sumDigits(digits):
	suma = 0
	for i in range(len(digits)):
		suma += digits[i]*(i)
	return suma

def getDigitsPon(digits, pos):
	digitsPon = []
	for i in range(10, pos, -1):
		digitsPon.append(digits[9-1]*i)
	return digitsPon

def minNumberOfDigits(n, k):
	digits = countDigits(n)
	diff = k - sumDigits(digits)
	if diff <= 0:
		return 0
	else:
		res = 0
		count = 0
		temp = 0
		while temp < diff:
			for i in range(digits[count]):
				temp += 9-count
				res += 1
				if temp >= diff:
					break
			count += 1
		return res

k, n = list(sys.stdin.read().split())
result = minNumberOfDigits(n, int(k))
print(result)


import sys
import math

def sumDigits(digits):
	suma = 0
	for d in digits:
		suma += d
	return suma

def getDiff(n, k):
	return k - sumDigits(n)

def minDigit(digits):
	min_n = digits[0]
	pos = 0
	for i in range(len(digits)):
		if digits[i] == 0:
			return (0, i)
		if digits[i] < min_n:
			min_n = digits[i]
			pos = i
	return (min_n, pos)

def minNumberOfDigits(n, k):
	dif = getDiff(n, k)
	if dif <= 0:
		return 0
	else:
		res = 0
		while dif > 0:
			minD = minDigit(n)
			dif -= (9 - minD[0])
			n.pop(minD[1])
			res += 1
		return res

k, n = list(map(int, sys.stdin.read().split()))
digits = [int(i) for i in str(n)]
result = minNumberOfDigits(digits, k)
print(result)


import sys
import math

def sumDigits(digits):
	suma = 0
	for d in digits:
		suma += d
	return suma

def getDiff(n, k):
	return k - sumDigits(n)

def minDigit(digits):
	return min(digits)

def minNumberOfDigits(n, k):
	dif = getDiff(n, k)
	if dif <= 0:
		return 0
	else:
		goal = int(math.ceil(dif/9))
		res = 0
		while goal > 0:
			goal -= minDigit(n)
			res += 1
		return res

k, n = list(map(int, sys.stdin.read().split()))
digits = [int(i) for i in str(n)]
result = minNumberOfDigits(digits, k)
print(result)


import sys
import math

def sumDigits(digits):
	suma = 0
	for d in digits:
		suma += d
	return suma

def getDiff(n, k):
	return k - sumDigits(n)

def minDigit(digits):
	min_n = digits[0]
	pos = 0
	for i in range(len(digits)):
		if digits[i] < min_n:
			min_n = digits[i]
			pos = i
	return min(digits), pos

def minNumberOfDigits(n, k):
	dif = getDiff(n, k)
	if dif <= 0:
		return 0
	else:
		goal = int(math.ceil(dif/9))
		res = 0
		while goal > 0:
			minD = minDigit(n)
			goal -= minD[0]
			n.pop(minD[1])
			res += 1
		return res

k, n = list(map(int, sys.stdin.read().split()))
digits = [int(i) for i in str(n)]
result = minNumberOfDigits(digits, k)
print(result)


import sys
import math

def sumDigits(digits):
	suma = 0
	for d in digits:
		suma += d
	return suma

def getDiff(n, k):
	return k - sumDigits(n)

def minDigit(digits):
	min_n = digits[0]
	pos = 0
	for i in range(len(digits)):
		if digits[i] < min_n:
			min_n = digits[i]
			pos = i
	return (min_n, pos)

def minNumberOfDigits(n, k):
	dif = getDiff(n, k)
	if dif <= 0:
		return 0
	else:
		res = 0
		while dif > 0:
			minD = minDigit(n)
			dif -= (9 - minD[0])
			n.pop(minD[1])
			res += 1
		return res

k, n = list(map(int, sys.stdin.read().split()))
digits = [int(i) for i in str(n)]
result = minNumberOfDigits(digits, k)
print(result)


x=input("")
x=int(x)
y=input("")

check=int(y[0])+int(y[1])
if  check<x:
    print(x-check)
else:
    print(0)


x=input("")
x=int(x)
y=input("")
add=0
for i in y:
    add+= int(i)
if  add<x:
    print(x-add)
else:
    print(0)


x=input("")
x=int(x)
y=(input(""))
holder=[]
counter=0
add=0
for i in y:
    add+= int(i)
    holder.append(int(i))
holder.sort()
if  add<x:
    while x>add:
        add+= 9-holder[counter]
        counter+=1

    print(counter)
else:
    print(0)


k = int(input())
arr = list(map(int, input()))
s = 0
cambios = 0
for i in range(len(arr)):
    s += arr[i]

if(s >= k):
    print(0)
else:
    for i in range(0, len(arr)):
        if(s<k and arr[i]!=9):
            s += 9-arr[i]
            cambios += 1
        elif(arr[i] == 9):
            pass
        else:
            break
    print(cambios)


k = int(input())
arr = list(map(int, input()))
s = 0
cambios = 0
for i in range(len(arr)):
    s += arr[i]

if(s >= k):
    print(0)
else:
    m = 0
    arr.sort()
    for i in range(0, len(arr)):
        if(s<k):
            s += 9-arr[i]
            cambios += 1
        else:
            break
    print(cambios)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = a[0]
b.append(8-a[0])
n = len(a)
for i in range(1,n):
    sumi+=a[i]
    b.append(9-a[i])
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = 0
n = len(a)
for i in range(n):
    sumi+=a[i]
    b.append(max(9-a[i],a[i]-0))
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = a[0]
b.append(8-a[0])
n = len(a)
for i in range(n):
    sumi+=a[i]
    b.append(9-a[i])
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = a[i]
b.append(8-a[i])
n = len(a)
for i in range(n):
    sumi+=a[i]
    b.append(9-a[i])
print(k,sumi)
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    print(b)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = a[0]
b.append(8-a[i])
n = len(a)
for i in range(n):
    sumi+=a[i]
    b.append(9-a[i])
print(k,sumi)
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    print(b)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = a[0]
b.append(9-a[0])
n = len(a)
for i in range(1,n):
    sumi+=a[i]
    b.append(9-a[i])
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = 0
n = len(a)
for i in range(n):
    sumi+=a[i]
    if i==0:
        b.append(max(8-a[i],a[i]-1))
    else:
        b.append(max(9-a[i],a[i]-0))
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

k=r()
a = list(map(int,input()))
b = []
sumi = a[0]
b.append(8-a[0])
n = len(a)
for i in range(n):
    sumi+=a[i]
    b.append(9-a[i])
print(k,sumi)
if k<=sumi:
    print(0)
else:
    change=k-sumi
    b.sort(reverse=True)
    print(b)
    i=0
    while change>0 and i<n:
        change-=b[i]
        i+=1
    print(i)


def main():
    k = int(input())

    digits = dict()
    for digit in "0123456789":
        digits[digit] = 0

    n = [int(d) for d in sorted(input().strip())]
    digit_sum = sum(n)

    k = k - digit_sum
    count = 0
    for d in n:
        if k <= 0 or d == 9:
            break

        k -= (9 - d)
        count += 1

    return count

print(main())


def main():
    k = int(input())

    digits = dict()
    for digit in "0123456789":
        digits[digit] = 0

    n = input()
    digit_sum = 0

    for digit in n:
        digits[digit] += 1
        digit_sum += int(digit)

    k = k - digit_sum
    count = 0
    for digit in "0123456789":
        if k < (9 - int(digit)) * digits[digit]:
            count += max(int(k / (9 - int(digit))) + 1, 0)
            break
        else:
            k -= (9 - int(digit)) * digits[digit]
            count += digits[digit]

    return count

print(main())


def main():
    k = int(input())

    digits = dict()
    for digit in "0123456789":
        digits[digit] = 0

    n = input()
    digit_sum = 0

    for digit in n:
        digits[digit] += 1
        digit_sum += int(digit)

    k = k - digit_sum
    count = 0
    for digit in "012345678":
        if k < (9 - int(digit)) * digits[digit]:
            count += max(int(k / (9 - int(digit))) + 1, 0)
            break
        else:
            k -= (9 - int(digit)) * digits[digit]
            count += digits[digit]

    return count

print(main())


def main():
    k = int(input())

    digits = dict()
    for digit in "0123456789":
        digits[digit] = 0

    n = input()
    digit_sum = 0

    for digit in n:
        digits[digit] += 1
        digit_sum += int(digit)

    k = k - digit_sum
    count = 0
    for digit in "0123456789":
        if k < (9 - int(digit)) * digits[digit]:
            count += int(k / (9 - int(digit))) + 1
            break
        else:
            k -= (9 - int(digit)) * digits[digit]
            count += digits[digit]

    return count

print(main())


k = int(input())
n = input()
q = 0
for i in range(len(n)):
    q += int(n[i])
if q < k:
        print(1)
else:
    print(0)


k = int(input())
n = input()
q = 0
for i in range(len(n)):
    q += int(n[i])
if q < k:
    print(k - q)
else:
    print(0)


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,input()))

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>k):
        print("0")

    else:
        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)
            if (suma>=k):
                print(digitos)
                break

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,str(input())))
    if k==900000:
        print("jjj")

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>=k):
        print("0")

    else:

        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)

            if (suma>=k):
                break
        print(digitos)

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

'''
if (k == 1) {
	    cout << 0 << "\n";

	    return 0;
	  }

	  vvull digits(10);
	  ull sum = 0;

	  for (ull i = 0; i < n.size(); ++i) {
	    int digit = n[i] - '0';
	    sum += digit;
	    digits[digit].push_back(i);
	  }

	  ull col = 0, row = 0;
	  ull mnd = 0;

	  while (sum < k) {
	    if (row >= digits[col].size()) {
	      ++col;
	      row = 0;
	    }

	    if (digits[col].size() == 0) {
	      ++col;
	      continue;
	    }

	    int index = digits[col][row];
	    sum -= n[index] - '0';
	    n[index] = '9';
	    sum += 9;
	    ++row;
	    ++mnd;
	  }

	  cout << mnd << "\n";
	  return 0;
'''
if __name__ == '__main__':
    k=int(input())
    l=int(input())
    l=str(l)
    l=list(map(int,l))
    l=sorted(l)
    suma=sum(l)
    d = 0;
    if(suma >= k):
        print(0)
    else:
        for i in range(0, len(l)):
            d += 1;
            suma += 9 - l[i];
            if(suma >= k):
                break

        print(d)


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,input()))

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>k):
        print("0")

    else:
        while True:
            if difer<10:
                digitos=digitos+1
                break
            else:
                difer=difer/10
                digitos=digitos+1

        print(digitos)

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,input()))

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>k):
        print("0")

    else:
        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            print(suma)
            suma=sum(l)
            if (suma>=k):
                print(digitos)
                break

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=int(input())
    l=str(l)
    l=list(map(int,l))
    if (k == 900000):
        print(100000)
    else:

        suma=sum(l)
        digitos=0
        difer=k-suma

        if (suma>=k):
            print("0")

        else:

            l=sorted(l)
            for i in range(0,len(l)):
                l[i]=9
                digitos=digitos+1
                suma=sum(l)

                if (suma>=k):
                    break
            print(digitos)

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,input()))

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>=k):
        print("0")

    else:
        if k==900000:
            print('no')

        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)

            if (suma>=k):
                print(digitos)
                break

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,input()))
    if k==900000:
        print('no')

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>=k):
        print("\n->"+"0")

    else:
        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)

            if (suma>=k):
                print("\n->"+digitos)
                break

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,input()))
    if k==900000:
        print('no')

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>=k):
        print("0")

    else:
        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)

            if (suma>=k):
                print(digitos)
                break

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,str(input())))

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>=k):
        print("0")

    else:

        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)

            if (suma>=k):
                break
        print(digitos)

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=int(input())
    l=str(l)
    l=list(map(int,l))

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>=k):
        print("0")

    else:

        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)

            if (suma>=k):
                break
        print(digitos)

    #if la dif es mayor que 9


#K=suma de los digitos de N es mayor=
#J es el nuevo

if __name__ == '__main__':
    k=int(input())
    l=list(map(int,input()))

    suma=sum(l)
    digitos=0
    difer=k-suma

    if (suma>k):
        print("0")

    else:
        l=sorted(l)
        for i in range(0,len(l)):
            l[i]=9
            digitos=digitos+1
            suma=sum(l)
            if (suma>k):
                print(digitos)
                break

    #if la dif es mayor que 9


k = int(input().strip())
n = input().strip()
ln = len(n)
val_n = 0
for x in range(ln):
    val_n += int(n[x])

if val_n >= k:
    print(0)

else:
    valsDiff = 0
    min_n = 9
    while val_n < k:
        min_n = 9
        for x in range(ln):
            if int(n[x]) < min_n:
                min_n = int(n[x])
        val_n -= min_n
        val_n += 9
        valsDiff += 1
    print(valsDiff)


k = int(input().strip())
n = input().strip()
ln = len(n)
val_n = 0
for x in range(ln):
    val_n += int(n[x])
if val_n >= k:
    print(0)
else:
    val = 0
    valsDiff = 0
    min_n = 9
    while val_n < k:
        min_n = 9
        for x in range(ln):
            if int(n[x]) < min_n:
                min_n = int(n[x])
        for x in range(ln):
            if int(n[x]) == min_n:
                val = x
                break
        n = n[:val] + '9' + n[val+1:]
        val_n -= min_n
        val_n += 9
        valsDiff += 1
    print(valsDiff)


k = int(input().strip())
n = input().strip()
ln = len(n)
val_n = 0
cnt = {}
for x in range(10):
    cnt[str(x)] = 0
for x in range(ln):
    val_n += int(n[x])
    cnt[n[x]] += 1
if val_n >= k:
    print(0)

else:
    valsDiff = 0
    while k > val_n:
        for x in range(10):
            if cnt[str(x)] != 0:
                val_n -= x
                val_n += 9
                valsDiff += 1
                cnt[str(x)] -= 1
                break
    print(valsDiff)