using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest.Codeforces.Round50
{
    class D
    {
        int N, K;
        StringBuilder res;
        string name, digits;
        bool[] fix;

        bool dfs(int idx)
        {
            if (idx >= N)
            {
                string s = res.ToString();
                for (int i = -1; (i = s.IndexOf(name, i + 1)) >= 0; )
                    if (!fix[i])
                        return false;
                return true;
            }

            if (fix[idx]) return dfs(idx + 1);
            for (int i = 0; i < K; i++)
            {
                res[idx] = (char)(i + 'a');
                if (idx >= name.Length - 1)
                {
                    bool ok = false;
                    for (int j = 0; j < name.Length; j++)
                    {
                        if (res[idx - j] != name[name.Length - 1 - j])
                        {
                            ok = true;
                            break;
                        }
                    }
                    if (ok && dfs(idx + 1)) return true;
                }
                else if (dfs(idx + 1)) return true;
            }
            return false;
        }

        D(Scanner scanner)
        {
            N = scanner.NextInt();
            K = scanner.NextInt();
            name = scanner.NextString();
            digits = scanner.NextString() + "".PadLeft(name.Length - 1, '0');
            res = new StringBuilder("".PadLeft(N));
            fix = new bool[digits.Length];
            //Console.WriteLine(digits);

            for (int i = 0; i < digits.Length; i++)
                if (digits[i] == '1')
                    for (int j = 0; j < name.Length; j++)
                        res[i + j] = name[j];

            for (int i = 0; i < digits.Length; i++)
                if (digits[i] == '1')
                    for (int j = 0; j < name.Length; j++)
                    {
                        if (res[i + j] != name[j])
                        {
                            Console.WriteLine("No solution");
                            return;
                        }
                        fix[i + j] = true;
                    }

            Console.WriteLine(dfs(0) ? res.ToString() : "No solution");
        }

        public static void Main()
        {
            //new D(Scanner.FromString(in1));
            new D(Scanner.FromConsole());
        }

        const string in1 = @"12 5
abacaba
010001
";

        #region Scanner
        public class Scanner : IDisposable
        {
            const int MAX_BUFFER_SIZE = 1024 * 1024 * 16;
            const string DELIMITER = " \r\n\t";

            System.IO.TextReader stream;
            int pos = 0, len = 0;
            bool endStream = false;
            int BufferSize = MAX_BUFFER_SIZE;
            char[] buffer = new char[MAX_BUFFER_SIZE];

            public enum Option { Buffering, NoBuffering }

            public Scanner(System.IO.TextReader stream, Option bufferingOption)
            {
                this.stream = stream;
                if (bufferingOption == Option.NoBuffering) BufferSize = 1;
            }

            void ReadBuffer()
            {
                pos = 0;
                len = stream.ReadBlock(buffer, 0, BufferSize);
                endStream = len == 0;
            }

            void SkipDelimiter()
            {
                while (!endStream && IsDelimiter(Peek())) NextChar();
            }

            static bool IsDelimiter(char c)
            {
                return DELIMITER.Contains(c);
            }

            bool Continue(char c)
            {
                return !endStream && !IsDelimiter(c);
            }

            char Peek()
            {
                if (pos >= len) ReadBuffer();
                return buffer[pos];
            }

            public char NextChar()
            {
                if (pos >= len) ReadBuffer();
                return buffer[pos++];
            }

            public string NextString()
            {
                SkipDelimiter();
                StringBuilder res = new StringBuilder();
                for (char c = NextChar(); Continue(c); c = NextChar()) res.Append(c);
                return res.ToString();
            }

            public int NextInt()
            {
                SkipDelimiter();
                int res = 0;
                char c = NextChar();
                int sign = 1;
                if (c == '-') { sign = -1; c = NextChar(); }
                for (; Continue(c); c = NextChar())
                    res = res * 10 + (c - '0');
                return sign * res;
            }

            public long NextLong()
            {
                SkipDelimiter();
                long res = 0;
                char c = NextChar();
                long sign = 1;
                if (c == '-') { sign = -1; c = NextChar(); }
                for (; Continue(c); c = NextChar())
                    res = res * 10 + (c - '0');
                return sign * res;
            }

            public double NextDouble()
            {
                return double.Parse(NextString());
            }

            public int[] NextInts(int n)
            {
                int[] res = new int[n];
                for (int i = 0; i < n; i++) res[i] = NextInt();
                return res;
            }

            public long[] NextLongs(int n)
            {
                long[] res = new long[n];
                for (int i = 0; i < n; i++) res[i] = NextLong();
                return res;
            }

            public double[] NextDoubles(int n)
            {
                double[] res = new double[n];
                for (int i = 0; i < n; i++) res[i] = NextDouble();
                return res;
            }

            public string[] NextStrings(int n)
            {
                string[] res = new string[n];
                for (int i = 0; i < n; i++) res[i] = NextString();
                return res;
            }

            public static Scanner FromString(string s)
            {
                return new Scanner(new System.IO.StreamReader(new System.IO.MemoryStream(Encoding.ASCII.GetBytes(s))), Option.Buffering);
            }

            public static Scanner FromFile(string path)
            {
                return new Scanner(new System.IO.StreamReader(path), Option.Buffering);
            }

            public static Scanner FromConsole()
            {
                return new Scanner(Console.In, Option.Buffering);
            }

            public void Dispose()
            {
                stream.Close();
            }
        }
        #endregion
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest.Codeforces.Round50
{
    class D
    {
        int N, K;
        StringBuilder res;
        string name, digits;
        bool[] fix;

        bool dfs(int idx)
        {
            //Console.WriteLine(idx);
            if (idx >= N)
            {
                //Console.WriteLine("check");
                string s = res.ToString();
                //Console.WriteLine(s);
                for (int i = -1; (i = s.IndexOf(name, i + 1)) >= 0; )
                {
                    //Console.WriteLine("{0}: {1}", i, fix[i]);
                    if (digits[i] == '0')
                        return false;
                }
                return true;
            }

            if (fix[idx]) return dfs(idx + 1);
            for (int i = 0; i < K; i++)
            {
                res[idx] = (char)(i + 'a');
                bool bad = false;
                string s = res.ToString();
                for (int j = idx - name.Length + 1; j <= idx + name.Length - 1; j++)
                    if (j >= 0 && s.Substring(j, name.Length) == name)
                    {
                        //Console.WriteLine(s.Substring(j,name.Length));
                        bad = true;
                        break;
                    }
                if (!bad && dfs(idx + 1)) return true;
#if false
                if (idx >= name.Length - 1)
                {
                    bool ok = false;
                    for (int j = 0; j < name.Length; j++)
                    {
                        if (res[idx - j] != name[name.Length - 1 - j])
                        {
                            ok = true;
                            break;
                        }
                    }
                    if (ok && dfs(idx + 1)) return true;
                }
                else if (dfs(idx + 1)) return true;
#endif
            }
            return false;
        }

        D(Scanner scanner)
        {
            N = scanner.NextInt();
            K = scanner.NextInt();
            name = scanner.NextString();
            digits = scanner.NextString() + "".PadLeft(name.Length - 1, '0');
            res = new StringBuilder("".PadLeft(N));
            fix = new bool[digits.Length];
            //Console.WriteLine(digits);

            for (int i = 0; i < digits.Length; i++)
                if (digits[i] == '1')
                    for (int j = 0; j < name.Length; j++)
                        res[i + j] = name[j];

            for (int i = 0; i < digits.Length; i++)
            {
                bool same = true;
                for (int j = 0; j < name.Length; j++)
                {
                    if (i + j >= N) { same = false; break; }
                    if (res[i + j] != name[j])
                        same = false;
                    if(digits[i] == '1')
                        fix[i + j] = true;
                }
                if (digits[i] == '1' != same)
                {
                    Console.WriteLine("No solution");
                    return;
                }
            }

            Console.WriteLine(dfs(0) ? res.ToString() : "No solution");
        }

        public static void Main()
        {
            new D(Scanner.FromString(in1));
            new D(Scanner.FromConsole());
        }

        const string in1 = @"100 2
bab
10001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010
";

        const string in2 = @"12 5
abacaba
010001
";

        #region Scanner
        public class Scanner : IDisposable
        {
            const int MAX_BUFFER_SIZE = 1024 * 1024 * 16;
            const string DELIMITER = " \r\n\t";

            System.IO.TextReader stream;
            int pos = 0, len = 0;
            bool endStream = false;
            int BufferSize = MAX_BUFFER_SIZE;
            char[] buffer = new char[MAX_BUFFER_SIZE];

            public enum Option { Buffering, NoBuffering }

            public Scanner(System.IO.TextReader stream, Option bufferingOption)
            {
                this.stream = stream;
                if (bufferingOption == Option.NoBuffering) BufferSize = 1;
            }

            void ReadBuffer()
            {
                pos = 0;
                len = stream.ReadBlock(buffer, 0, BufferSize);
                endStream = len == 0;
            }

            void SkipDelimiter()
            {
                while (!endStream && IsDelimiter(Peek())) NextChar();
            }

            static bool IsDelimiter(char c)
            {
                return DELIMITER.Contains(c);
            }

            bool Continue(char c)
            {
                return !endStream && !IsDelimiter(c);
            }

            char Peek()
            {
                if (pos >= len) ReadBuffer();
                return buffer[pos];
            }

            public char NextChar()
            {
                if (pos >= len) ReadBuffer();
                return buffer[pos++];
            }

            public string NextString()
            {
                SkipDelimiter();
                StringBuilder res = new StringBuilder();
                for (char c = NextChar(); Continue(c); c = NextChar()) res.Append(c);
                return res.ToString();
            }

            public int NextInt()
            {
                SkipDelimiter();
                int res = 0;
                char c = NextChar();
                int sign = 1;
                if (c == '-') { sign = -1; c = NextChar(); }
                for (; Continue(c); c = NextChar())
                    res = res * 10 + (c - '0');
                return sign * res;
            }

            public long NextLong()
            {
                SkipDelimiter();
                long res = 0;
                char c = NextChar();
                long sign = 1;
                if (c == '-') { sign = -1; c = NextChar(); }
                for (; Continue(c); c = NextChar())
                    res = res * 10 + (c - '0');
                return sign * res;
            }

            public double NextDouble()
            {
                return double.Parse(NextString());
            }

            public int[] NextInts(int n)
            {
                int[] res = new int[n];
                for (int i = 0; i < n; i++) res[i] = NextInt();
                return res;
            }

            public long[] NextLongs(int n)
            {
                long[] res = new long[n];
                for (int i = 0; i < n; i++) res[i] = NextLong();
                return res;
            }

            public double[] NextDoubles(int n)
            {
                double[] res = new double[n];
                for (int i = 0; i < n; i++) res[i] = NextDouble();
                return res;
            }

            public string[] NextStrings(int n)
            {
                string[] res = new string[n];
                for (int i = 0; i < n; i++) res[i] = NextString();
                return res;
            }

            public static Scanner FromString(string s)
            {
                return new Scanner(new System.IO.StreamReader(new System.IO.MemoryStream(Encoding.ASCII.GetBytes(s))), Option.Buffering);
            }

            public static Scanner FromFile(string path)
            {
                return new Scanner(new System.IO.StreamReader(path), Option.Buffering);
            }

            public static Scanner FromConsole()
            {
                return new Scanner(Console.In, Option.Buffering);
            }

            public void Dispose()
            {
                stream.Close();
            }
        }
        #endregion
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest.Codeforces.Round50
{
    class D
    {
        int N, K;
        StringBuilder res;
        string name, digits;
        bool[] fix;

        bool dfs(int idx)
        {
            if (idx >= N) return true;
            if (fix[idx]) return dfs(idx + 1);
            for (int i = 0; i < K; i++)
            {
                res[idx] = (char)(i + 'a');
                if (idx >= name.Length - 1)
                {
                    bool ok = false;
                    for (int j = 0; j < name.Length; j++)
                    {
                        if (res[idx - j] != name[name.Length - 1 - j])
                        {
                            ok = true;
                            break;
                        }
                    }
                    if (ok && dfs(idx + 1)) return true;
                }
            }
            return false;
        }

        D(Scanner scanner)
        {
            N = scanner.NextInt();
                K = scanner.NextInt();
            name = scanner.NextString();
            digits = scanner.NextString() + "".PadLeft(name.Length-1, '0');
            res = new StringBuilder("".PadLeft(N));
            fix = new bool[digits.Length];
            //Console.WriteLine(digits);

            for (int i = 0; i < digits.Length; i++)
                if (digits[i] == '1')
                    for (int j = 0; j < name.Length; j++)
                        res[i + j] = name[j];

            for (int i = 0; i < digits.Length; i++)
                if (digits[i] == '1')
                    for (int j = 0; j < name.Length; j++)
                    {
                        if (res[i + j] != name[j])
                        {
                            Console.WriteLine("No solution");
                            return;
                        }
                        fix[i + j] = true;
                    }

            Console.WriteLine(dfs(0) ? res.ToString() : "No solution");
        }

        public static void Main()
        {
            //new D(Scanner.FromString(in1));
            new D(Scanner.FromConsole());
        }

        const string in1 = @"5 2
a
10001
";

        #region Scanner
        public class Scanner : IDisposable
        {
            const int MAX_BUFFER_SIZE = 1024 * 1024 * 16;
            const string DELIMITER = " \r\n\t";

            System.IO.TextReader stream;
            int pos = 0, len = 0;
            bool endStream = false;
            int BufferSize = MAX_BUFFER_SIZE;
            char[] buffer = new char[MAX_BUFFER_SIZE];

            public enum Option { Buffering, NoBuffering }

            public Scanner(System.IO.TextReader stream, Option bufferingOption)
            {
                this.stream = stream;
                if (bufferingOption == Option.NoBuffering) BufferSize = 1;
            }

            void ReadBuffer()
            {
                pos = 0;
                len = stream.ReadBlock(buffer, 0, BufferSize);
                endStream = len == 0;
            }

            void SkipDelimiter()
            {
                while (!endStream && IsDelimiter(Peek())) NextChar();
            }

            static bool IsDelimiter(char c)
            {
                return DELIMITER.Contains(c);
            }

            bool Continue(char c)
            {
                return !endStream && !IsDelimiter(c);
            }

            char Peek()
            {
                if (pos >= len) ReadBuffer();
                return buffer[pos];
            }

            public char NextChar()
            {
                if (pos >= len) ReadBuffer();
                return buffer[pos++];
            }

            public string NextString()
            {
                SkipDelimiter();
                StringBuilder res = new StringBuilder();
                for (char c = NextChar(); Continue(c); c = NextChar()) res.Append(c);
                return res.ToString();
            }

            public int NextInt()
            {
                SkipDelimiter();
                int res = 0;
                char c = NextChar();
                int sign = 1;
                if (c == '-') { sign = -1; c = NextChar(); }
                for (; Continue(c); c = NextChar())
                    res = res * 10 + (c - '0');
                return sign * res;
            }

            public long NextLong()
            {
                SkipDelimiter();
                long res = 0;
                char c = NextChar();
                long sign = 1;
                if (c == '-') { sign = -1; c = NextChar(); }
                for (; Continue(c); c = NextChar())
                    res = res * 10 + (c - '0');
                return sign * res;
            }

            public double NextDouble()
            {
                return double.Parse(NextString());
            }

            public int[] NextInts(int n)
            {
                int[] res = new int[n];
                for (int i = 0; i < n; i++) res[i] = NextInt();
                return res;
            }

            public long[] NextLongs(int n)
            {
                long[] res = new long[n];
                for (int i = 0; i < n; i++) res[i] = NextLong();
                return res;
            }

            public double[] NextDoubles(int n)
            {
                double[] res = new double[n];
                for (int i = 0; i < n; i++) res[i] = NextDouble();
                return res;
            }

            public string[] NextStrings(int n)
            {
                string[] res = new string[n];
                for (int i = 0; i < n; i++) res[i] = NextString();
                return res;
            }

            public static Scanner FromString(string s)
            {
                return new Scanner(new System.IO.StreamReader(new System.IO.MemoryStream(Encoding.ASCII.GetBytes(s))), Option.Buffering);
            }

            public static Scanner FromFile(string path)
            {
                return new Scanner(new System.IO.StreamReader(path), Option.Buffering);
            }

            public static Scanner FromConsole()
            {
                return new Scanner(Console.In, Option.Buffering);
            }

            public void Dispose()
            {
                stream.Close();
            }
        }
        #endregion
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.IO;
using System.Linq;
using System.Threading;

class Program
{
    string s;
    bool[] should;
    int[,] dp;
    char[,] by;
    int k;
    int n;
    void solve()
    {
        n = nextInt();
        k = nextInt();
        s = nextString();
        string t = nextString();
        should = new bool[n + 1];
        for (int i = 0; i < t.Length; i++)
            should[i + s.Length] = (t[i] == '1');
        dp = new int[n, s.Length + 1];
        for (int i = 0; i < n; i++)
            for (int j = 0; j <= s.Length; j++)
                dp[i, j] = -1;
        by = new char[n, s.Length + 1];
        int num = go(0, 0);
        if (num == 0)
            println("No solution");
        else
        {
            string res = "";
            int at=0;
            int pref=0;
            while (at < n)
            {
                res += by[at, pref];
                char z = by[at, pref];
                int x = get(s.Substring(0, pref) + by[at, pref]);
                pref = x;
                at++;
            }
            println(res);
        }

    }

    private int get(string x)
    {
        for (int L = s.Length; L >= 0; L--)
            if (x.EndsWith(s.Substring(0, L)))
                return L;
        throw new Exception();

    }

    private int go(int at, int pref)
    {
        if (at == n)
            return 1;
        if (dp[at, pref] != -1)
            return dp[at, pref];
        int res = 0;
        for (char c = 'a'; c < (char)('a' + k); c++)
        {
            int nextP = get(s.Substring(0, pref) + c);
            if (should[at + 1] && nextP != s.Length)
                continue;
            if (!should[at + 1] && nextP == s.Length)
                continue;
            if (go(at + 1, nextP)==1)
            {
                res = 1;
                by[at, pref] = c;
                break;
            }
        }
        return dp[at, pref] = res;
    }

    ////////////
    private void println(int[] ar)
    {
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i]);
            else
                print(ar[i] + " ");
        }
    }
    private void println(int[] ar, bool add)
    {
        int A = 0;
        if (add)
            A++;
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i] + A);
            else
                print((ar[i] + A) + " ");
        }
    }

    private void println(string Stringst)
    {
        Console.WriteLine(Stringst);
    }
    private void println(char charnum)
    {
        Console.WriteLine(charnum);
    }
    private void println(int Intnum)
    {
        Console.WriteLine(Intnum);
    }
    private void println(long Longnum)
    {
        Console.WriteLine(Longnum);
    }
    private void println(double Doublenum)
    {
        string s = Doublenum.ToString(CultureInfo.InvariantCulture);
        Console.WriteLine(s);
    }

    private void print(string Stringst)
    {
        Console.Write(Stringst);
    }
    private void print(int Intnum)
    {
        Console.Write(Intnum);
    }
    private void print(char charnum)
    {
        Console.Write(charnum);
    }
    private void print(long Longnum)
    {
        Console.Write(Longnum);
    }
    private void print(double Doublenum)
    {
        Console.Write(Doublenum);
    }

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (inputLine.Length == 0)
            readInput();

    }
    int nextInt()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return int.Parse(inputLine[inputInd++]);
    }
    long nextLong()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return long.Parse(inputLine[inputInd++]);
    }
    double nextDouble()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return double.Parse(inputLine[inputInd++]);
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        new Program().solve();
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.IO;
using System.Linq;
using System.Threading;

class Program
{
    string s;
    bool[] should;
    int[,] dp;
    char[,] by;
    int k;
    int n;
    Dictionary<string, int> cached;
    void solve()
    {
        n = nextInt();
        k = nextInt();
        s = nextString();
        string t = nextString();
        should = new bool[n + 1];
        for (int i = 0; i < t.Length; i++)
            should[i + s.Length] = (t[i] == '1');
        dp = new int[n, s.Length + 1];
        for (int i = 0; i < n; i++)
            for (int j = 0; j <= s.Length; j++)
                dp[i, j] = -1;
        by = new char[n, s.Length + 1];
        cached = new Dictionary<string, int>();
        int num = go(0, 0);
        if (num == 0)
            println("No solution");
        else
        {
            string res = "";
            int at=0;
            int pref=0;
            while (at < n)
            {
                res += by[at, pref];
                char z = by[at, pref];
                int x = get(s.Substring(0, pref) + by[at, pref]);
                pref = x;
                at++;
            }
            println(res);
        }

    }

    private int get(string x)
    {
        if (cached.ContainsKey(x))
            return cached[x];
        for (int L = s.Length; L >= 0; L--)
            if (x.EndsWith(s.Substring(0, L)))
                return cached[x]=L;
        throw new Exception();

    }

    private int go(int at, int pref)
    {
        if (at == n)
            return 1;
        if (dp[at, pref] != -1)
            return dp[at, pref];
        int res = 0;
        for (char c = 'a'; c < (char)('a' + k); c++)
        {
            int nextP = get(s.Substring(0, pref) + c);
            if (should[at + 1] && nextP != s.Length)
                continue;
            if (!should[at + 1] && nextP == s.Length)
                continue;
            if (go(at + 1, nextP)==1)
            {
                res = 1;
                by[at, pref] = c;
                break;
            }
        }
        return dp[at, pref] = res;
    }

    ////////////
    private void println(int[] ar)
    {
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i]);
            else
                print(ar[i] + " ");
        }
    }
    private void println(int[] ar, bool add)
    {
        int A = 0;
        if (add)
            A++;
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i] + A);
            else
                print((ar[i] + A) + " ");
        }
    }

    private void println(string Stringst)
    {
        Console.WriteLine(Stringst);
    }
    private void println(char charnum)
    {
        Console.WriteLine(charnum);
    }
    private void println(int Intnum)
    {
        Console.WriteLine(Intnum);
    }
    private void println(long Longnum)
    {
        Console.WriteLine(Longnum);
    }
    private void println(double Doublenum)
    {
        string s = Doublenum.ToString(CultureInfo.InvariantCulture);
        Console.WriteLine(s);
    }

    private void print(string Stringst)
    {
        Console.Write(Stringst);
    }
    private void print(int Intnum)
    {
        Console.Write(Intnum);
    }
    private void print(char charnum)
    {
        Console.Write(charnum);
    }
    private void print(long Longnum)
    {
        Console.Write(Longnum);
    }
    private void print(double Doublenum)
    {
        Console.Write(Doublenum);
    }

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (inputLine.Length == 0)
            readInput();

    }
    int nextInt()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return int.Parse(inputLine[inputInd++]);
    }
    long nextLong()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return long.Parse(inputLine[inputInd++]);
    }
    double nextDouble()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return double.Parse(inputLine[inputInd++]);
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        new Program().solve();
    }
}


#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <vector>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long       LL;
typedef pair<int, int>  PII;
typedef pair<LL, LL>    PLL;
typedef vector<int>     VI;
typedef vector<LL>      VL;
typedef vector<PII>     VPII;
typedef vector<VI>      VVI;
typedef vector<VPII>    VVPII;
#define MM(a,x) memset(a,x,sizeof(a));
#define ALL(x)  (x).begin(), (x).end()
#define P(x)	 cerr<<"["#x<<" = "<<(x)<<"]"<<endl;
#define P2(x,y)	 cerr<<"["#x" = "<<(x)<<", "#y" = "<<(y)<<"]"<<endl;
#define P3(x,y,z)cerr<<"["#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"]"<<endl;
#define PP(x,i)	 cerr<<"["#x<<i<<" = "<<x[i]<<"]"<<endl;
#define TM(a,b)	 cerr<<"["#a" -> "#b": "<<1e3*(b-a)/CLOCKS_PER_SEC<<"ms]\n";
#define UN(v)   sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define x first
#define y second
struct _ {_() {ios_base::sync_with_stdio(0);}} _;
template<class A, class B> ostream& operator<<(ostream &o, pair<A, B> t) {o << "(" << t.x << ", " << t.y << ")"; return o;}
template<class T> string tostring(T x, int len = 0, char c = '0') {stringstream ss; ss << x; string r = ss.str(); if(r.length() < len) r = string(len - r.length(), c) + r; return r;}
template<class T> void PV(T a, T b, int n = 0, int w = 0, string s = " ") {int c = 0; while(a != b) {cout << tostring(*a++, w, ' '); if(a != b && (n == 0 || ++c % n)) cout << s; else cout << "\n"; cout.flush();}}
template<class T> inline bool chmin(T &a, T b) {return a > b ? a = b, 1 : 0;}
template<class T> inline bool chmax(T &a, T b) {return a < b ? a = b, 1 : 0;}
const LL linf = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
const int N = 111;

int n, c, m;
string A, Name;
int need[N];
int dp[N][N];
int p1[N][N];
int p2[N][N];

map<string, int> M;
int go[N][26];

int main() {
	cin >> n >> c;
	cin >> A >> Name;

	m = A.size();
	for(int i = 0; i <= m; i++) {
		M[A.substr(0, i)] = i;
	}

	for(int i = 0; i <= m; i++) {
		for(int j = 0; j < c; j++) {
			string s = A.substr(0, i);
			s.pb(j + 'a');
			while(M.find(s) == M.end()) s = s.substr(1);
			go[i][j] = M[s];
		}
	}

	for(int i = 0; i < Name.size(); i++) if(Name[i] == '1') need[i + m - 1] = 1;

	dp[0][0] = 1;
	for(int i = 0; i < n; i++)
		for(int j = 0; j <= m; j++) {
			if(!dp[i][j]) continue;
			for(int k = 0; k < c; k++) {
				int to = go[j][k];
				if(need[i] == 1 && to != m) continue;
				if(to == m && need[i] != 1) continue;
				dp[i + 1][to] = 1;
				p1[i + 1][to] = k;
				p2[i + 1][to] = j;
			}
		}

	if(!dp[n][m]) {cout << "No solution" << endl; return 0;}

	string res;
	int pj = m;
	for(int i = n; i > 0; i--) {
		res.pb('a' + p1[i][pj]);
		pj = p2[i][pj];
	}
	reverse(ALL(res));
	cout << res << endl;
	return 0;
}


#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <vector>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long       LL;
typedef pair<int, int>  PII;
typedef pair<LL, LL>    PLL;
typedef vector<int>     VI;
typedef vector<LL>      VL;
typedef vector<PII>     VPII;
typedef vector<VI>      VVI;
typedef vector<VPII>    VVPII;
#define MM(a,x) memset(a,x,sizeof(a));
#define ALL(x)  (x).begin(), (x).end()
#define P(x)	 cerr<<"["#x<<" = "<<(x)<<"]"<<endl;
#define P2(x,y)	 cerr<<"["#x" = "<<(x)<<", "#y" = "<<(y)<<"]"<<endl;
#define P3(x,y,z)cerr<<"["#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"]"<<endl;
#define PP(x,i)	 cerr<<"["#x<<i<<" = "<<x[i]<<"]"<<endl;
#define TM(a,b)	 cerr<<"["#a" -> "#b": "<<1e3*(b-a)/CLOCKS_PER_SEC<<"ms]\n";
#define UN(v)   sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define x first
#define y second
struct _ {_() {ios_base::sync_with_stdio(0);}} _;
template<class A, class B> ostream& operator<<(ostream &o, pair<A, B> t) {o << "(" << t.x << ", " << t.y << ")"; return o;}
template<class T> string tostring(T x, int len = 0, char c = '0') {stringstream ss; ss << x; string r = ss.str(); if(r.length() < len) r = string(len - r.length(), c) + r; return r;}
template<class T> void PV(T a, T b, int n = 0, int w = 0, string s = " ") {int c = 0; while(a != b) {cout << tostring(*a++, w, ' '); if(a != b && (n == 0 || ++c % n)) cout << s; else cout << "\n"; cout.flush();}}
template<class T> inline bool chmin(T &a, T b) {return a > b ? a = b, 1 : 0;}
template<class T> inline bool chmax(T &a, T b) {return a < b ? a = b, 1 : 0;}
const LL linf = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
const int N = 111;

int n, c, m;
string A, Name;
int need[N];
int dp[N][N];
int p1[N][N];
int p2[N][N];

map<string, int> M;
int go[N][26];

int main() {
	cin >> n >> c;
	cin >> A >> Name;

	m = A.size();
	for(int i = 0; i <= m; i++) {
		M[A.substr(0, i)] = i;
	}

	for(int i = 0; i <= m; i++) {
		for(int j = 0; j < c; j++) {
			string s = A.substr(0, i);
			s.pb(j + 'a');
			while(M.find(s) == M.end()) s = s.substr(1);
			go[i][j] = M[s];
		}
	}

	for(int i = 0; i < Name.size(); i++) if(Name[i] == '1') need[i + m - 1] = 1;

	dp[0][0] = 1;
	for(int i = 0; i < n; i++)
		for(int j = 0; j <= m; j++) {
			if(!dp[i][j]) continue;
			for(int k = 0; k < c; k++) {
				int to = go[j][k];
				if(need[i] == 1 && to != m) continue;
				if(to == m && need[i] != 1) continue;
				dp[i + 1][to] = 1;
				p1[i + 1][to] = k;
				p2[i + 1][to] = j;
			}
		}

	int pj = -1;
	for(int i = 0; i <= m; i++) if(dp[n][i]) pj = i;
	if(pj == -1) {cout << "No solution" << endl; return 0;}

	string res;
	for(int i = n; i > 0; i--) {
		res.pb('a' + p1[i][pj]);
		pj = p2[i][pj];
	}
	reverse(ALL(res));
	cout << res << endl;
	return 0;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<set>
#include<map>

#include<queue>
#define FOR(i, a, b) for( int i = (a); i < (b); i++ )
#define ALL(A) (A.begin(), A.end())
#define Set(a, s) memset(a, s, sizeof (a))
#define pb push_back
#define mp make_pair
typedef long long LL;
using namespace std;

int n,k;
string s;
string x;
bool b[209];
int target;
int const B=31;
const int MOD = 10007;
int dp[101][101];
int F[109];
int pwr;

void failureFunction(const char* p)
{
    int m = strlen(p), k = 0;
    F[0] = 0;
    for (int q = 1; q <= m - 1; ++q) {
        while (k > 0 && p[k] != p[q])
            k = F[k - 1];
        if (p[k] == p[q])
            k++;
        F[q] = k;
    }
}

bool solve(int i, int h )
{

    if(i==n)
        return true;
    if(dp[i][h]!=-1)return dp[i][h];
    bool ret=0;
    for(char c ='a' ; c<k+'a' ; c++)
    {
        int temp = h;
        while (temp > 0 && s[temp] != c)
            temp = F[temp - 1];
        if(s[temp]==c)
            temp++;
        if(b[i] && temp==s.size())
            ret |= solve(i+1 , F[temp-1]);
        else if(!b[i] && temp!=s.size())
            ret |= solve(i+1 , temp);
    }

    return  dp[i][h] = ret;
}

void print(int i, int h)
{

    if(i==n)
        return;

    bool ret = 0;
    for(char c ='a' ; c<k+'a' ; c++)
    {
        int temp = h;
        while (temp > 0 && s[temp] != c)
            temp = F[temp - 1];
        if(s[temp]==c)
            temp++;
        if(b[i] && temp==s.size())
        {
            ret |= solve(i+1 , F[temp-1]);
            if(ret == solve(i,h))
            {
                putchar(c);
                print(i+1 , F[temp-1]);
                break;
            }
        }
        else if(!b[i] && temp!=s.size())
        {
            ret |= solve(i+1 , temp);
            if(ret == solve(i,h))
            {
                putchar(c);
                print(i+1 , temp);
                break;
            }
        }
    }

}
int main()
{
   // freopen("input.in", "r" , stdin);

    while(cin>>n>>k)
    {
        Set(dp,-1);
        cin>>s;
        failureFunction(s.c_str());
        cin>>x;
        Set(b,0);
        FOR(i,0,x.size())
            if(x[i]=='1')
                b[i+s.size()-1]=1;
        target = 0;
        pwr = 1;
        FOR(i,0,s.size())
        {
            if(i<s.size()-1)
                pwr = pwr*B;
            target = (((LL)(LL)target*(LL)B) + (LL)(s[i]-'a'+1) )%MOD;
        }
        if(solve(0,0))
        {
            print(0,0);
            putchar('\n');
        }
        else
            puts("No solution");

    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <time.h>
#include <vector>

#if LOCAL
	#define DO_NOT_SEND
#endif

typedef long long LL;

int IntMaxVal = (int) 1e20;
int IntMinVal = (int) -1e20;
LL LongMaxVal = (LL) 1e20;
LL LongMinVal = (LL) -1e20;

#define FOR(i, a, b) for(int i = a; i < b ; ++i)
#define FORD(i, a, b) for(int i = a; i >= b; --i)

#define minimize(a, b) { a = min(a, b); }
#define maximize(a, b) { a = max(a, b); }

#define all(v) v.begin(),v.end()

using namespace std;

#define next(type, i) type i; cin >> i;
template<typename T> struct argument_type;
template<typename T, typename U> struct argument_type<T(U)> { typedef U type; };
#define nextVector(t, v, size) vector< argument_type<void(t)>::type > v(size); { for (int i = 0 ; i < size ; i++) cin >> v[i]; }

#define range(name, start, count) vector<int> name(count); { for (int i = 0 ; i < count ; i++) name[i] = i + start; }

template <typename T1, typename T2> istream& operator >>(istream& is, pair<T1, T2>& s) { is >> s.first >> s.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T> &v) { for (int i = 0 ; i < v.size() ; i++) os << v[i] << ' '; os << endl; return os; }
template <typename T1, typename T2> ostream& operator <<(ostream& s, pair<T1, T2>& t) { s << t.first << ' ' << t.second; return s; }

template <typename T> vector<T> readVector(int n) { vector<T> res(n); for (int i = 0 ; i < n ; i++) cin >> res[i]; return res; }

bool formsExtras(int l, int r, vector<char> &res, string &s) {
	FOR (start, max(0, l - (int) s.length() + 1), min(r, (int) res.size() - (int) s.length() + 1)) {
		bool isMatch = true;
		FOR (i, 0, s.length()) if (res[start + i] != s[i]) isMatch = false;
		if (isMatch) return true;
	}
	return false;
}

bool increment(vector<char> &res, int l, int r, int k) {
	res[r]++;
	if (res[r] == 'a' + k) {
		if (r == l) return false;
		res[r] = 'a';
		return increment(res, l, r - 1, k);
	}
	return true;
}

int main() {
	srand (time(NULL));
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    next(int, n);
    next(int, k);

    next(string, s);
    next(string, occs);

    vector<char> res(n, '-');

    FOR (i, 0, occs.size()) if (occs[i] == '1') {
    	FOR (j, 0, s.length()) res[i + j] = s[j];
    }

    FOR (i, 0, occs.size()) {
    	bool isMatch = true;
    	bool shouldMatch = occs[i] == '1';
    	FOR (j, 0, s.length()) isMatch &= res[i + j] == s[j];
    	if (isMatch != shouldMatch) {
    		cout << "No solution" << endl;
    		return 0;
    	}
    }

    bool isSingleLetter = true;
    for (auto c : s) if (c != s[0]) isSingleLetter = false;

    if (isSingleLetter) {
    	char letter = s[0] == 'a' ? 'b' : 'a';
    	FOR (i, 0, n) if (res[i] == '-') res[i] = letter;
    } else {
    	FOR (l, 0, n) if (res[l] == '-') {
    		int r = l + 1;
	   		while (r < n && res[r] == '-') r++;
	   		FOR (i, l, r) res[i] = 'a';
	   		if (r - l < s.length()) {
	   			while (formsExtras(l, r, res, s)) {
	   				if (!increment(res, l, r - 1, k)) {
	   					cout << "No solution" << endl;
    					return 0;
	   				}
	   			}
	   		}
    	}
    }

    for (auto c : res) cout << c; cout << endl;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <time.h>
#include <vector>

#if LOCAL
	#define DO_NOT_SEND
#endif

typedef long long LL;

int IntMaxVal = (int) 1e20;
int IntMinVal = (int) -1e20;
LL LongMaxVal = (LL) 1e20;
LL LongMinVal = (LL) -1e20;

#define FOR(i, a, b) for(int i = a; i < b ; ++i)
#define FORD(i, a, b) for(int i = a; i >= b; --i)

#define minimize(a, b) { a = min(a, b); }
#define maximize(a, b) { a = max(a, b); }

#define all(v) v.begin(),v.end()

using namespace std;

#define next(type, i) type i; cin >> i;
template<typename T> struct argument_type;
template<typename T, typename U> struct argument_type<T(U)> { typedef U type; };
#define nextVector(t, v, size) vector< argument_type<void(t)>::type > v(size); { for (int i = 0 ; i < size ; i++) cin >> v[i]; }

#define range(name, start, count) vector<int> name(count); { for (int i = 0 ; i < count ; i++) name[i] = i + start; }

template <typename T1, typename T2> istream& operator >>(istream& is, pair<T1, T2>& s) { is >> s.first >> s.second; return is; }
template <typename T> ostream& operator << (ostream& os, const vector<T> &v) { for (int i = 0 ; i < v.size() ; i++) os << v[i] << ' '; os << endl; return os; }
template <typename T1, typename T2> ostream& operator <<(ostream& s, pair<T1, T2>& t) { s << t.first << ' ' << t.second; return s; }

template <typename T> vector<T> readVector(int n) { vector<T> res(n); for (int i = 0 ; i < n ; i++) cin >> res[i]; return res; }

int main() {
	srand (time(NULL));
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    next(int, n);
    next(int, k);

    next(string, s);
    next(string, occs);

    vector<char> res(n, '-');

    FOR (i, 0, occs.size()) if (occs[i] == '1') {
    	FOR (j, 0, s.length()) res[i + j] = s[j];
    }

    FOR (i, 0, occs.size()) {
    	bool isMatch = true;
    	bool shouldMatch = occs[i] == '1';
    	FOR (j, 0, s.length()) isMatch &= res[i + j] == s[j];
    	if (isMatch != shouldMatch) {
    		cout << "No solution" << endl;
    		return 0;
    	}
    }

    bool isSingleLetter = true;
    for (auto c : s) if (c != s[0]) isSingleLetter = false;

    char letter;
    if (isSingleLetter) {
    	letter = s[0] == 'a' ? 'b' : 'a';
    } else letter = 'a';

    FOR (i, 0, n) if (res[i] == '-') res[i] = letter;

    for (auto c : res) cout << c; cout << endl;
}


#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int n,m;
    char str[200];
    sscanf(gets(str),"%d%d",&n,&m);
    string o=gets(str);
    string r=gets(str);
    bool tag=count(o.begin(),o.end(),o[0])!=o.size();
    string s(n,tag?o[0]:(o[0]-'a'+1)%m+'a');
    for(size_t i=0;i<r.size();i++)
        if(r[i]=='1') for(size_t j=0;j<o.size();j++) s[i+j]=o[j];
    for(size_t i=0;i<r.size();i++){
        string u=s.substr(i,o.size());
        if(r[i]=='1' && u!=o
        || r[i]=='0' && u==o) return puts("No solution");
    }
    puts(s.c_str());
}


#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
using namespace std;
char s[1100],s2[1100];
int dp[110][110];
string ans[110][110];
int g[110][110];
int main()
{
    int n,K,len;
    while (scanf("%d%d",&n,&K)==2)
    {
        scanf("%s",s);
        int len=strlen(s);
        string tans="";
        for (int i=0;i<=len;i++)
        {
            for (int k=0;k<K;k++)
            {
                string next=tans;
                next.push_back(k+'a');
                int anss=0;
                int tlen=next.size();
                for (int ii=0;ii<tlen;ii++)
                {
                    int tnum=0;
                    for (int jj=ii;jj<tlen;jj++)
                    {
                        if (s[jj-ii]!=next[jj]) break;
                        tnum++;
                    }
                    if (tnum==tlen-ii) anss=max(anss,tnum);
                }
                g[i][k]=anss;
            }
            tans+=s[i];
        }
        scanf("%s",s2);
        memset(dp,0,sizeof(dp));
        int len2=strlen(s2);
        dp[0][0]=1;
        for (int i=0;i<n;i++)
            for (int j=0;j<len;j++)
                ans[i][j]="";
        for (int i=0;i<n;i++)
        {
            for (int j=0;j<=len;j++)
            {
                if (dp[i][j]==0) continue;
                if (dp[i][j])
                {
                    //printf("ans=%s\n",ans[i][j].c_str());
                    //printf("dp[%d][%d]=%d\n",i,j,1);
                }
                if (i-len>=0)
                {
                    if (s2[i-len]=='1'&&j!=len) continue;
                    if (s2[i-len]=='0'&&j==len) continue;
                }
                string temp="";
                int begin=max(0,i-j+1);
                for (int k=begin;k<i;k++)
                    temp+=ans[i][j][k];
                for (int k=0;k<K;k++)
                {
                    string next=temp;
                    next.push_back(k+'a');
                    //printf("%s\n",next.c_str());
                    int num=g[j][k];
                    //printf("%d\n",num);
                    if (dp[i+1][num]==0)
                    {
                        dp[i+1][num]=1;
                        ans[i+1][num]=ans[i][j];
                        ans[i+1][num].push_back(k+'a');
                    }
                }
            }
        }
        if (s2[len2-1]=='1')
        {
            if (dp[n][len]==0) puts("No solution");
            else printf("%s\n",ans[n][len].c_str());
        }
        else
        {
            bool find=false;
            for (int i=0;i<len;i++)
                if (dp[n][i])
                {
                    find=true;
                    printf("%s\n",ans[n][i].c_str());
                    break;
                }
            if (!find) puts("No solution");
        }
    }
    return 0;
}


//============================================================================
// Name        : problems.cpp
// Author      :2shraaf
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <bits/stdc++.h>

using namespace std;
//int Trie::searchWord(int k) {
//  int res = 0;
//    list<Node>le;
//    le.push_front(root);
//
//  while (!le.empty()) {
//      Node current  = le.front();
//      le.pop_front();
//      for (int i = 0; i < current.mChildren.size(); i++) {
//          if(current.mChildren[i]->sum<=k){
//              res++;
//              le.push_front(*current.mChildren[i]);
//
//          }
//
//      }
//  }
//  return res;
//}
//
vector<int> Z(string str) {
    vector<int> Z(str.size(), 0);
    int L = 0, R = 0;
    for (int i = 1; i < str.size(); i++) {
        if (i > R || Z[i - L] >= R - i + 1) {
            L = i;
            R = max(i, R);
            while (R < str.size() && str[R - L] == str[R])
                R++;
            Z[i] = (R--) - L;
        } else
            Z[i] = Z[i - L];
    }
    Z[0] = str.size();
    return Z;
}

int main()

{
    int n, k;
    cin >> n >> k;
    string s, t;
    cin >> s >> t;
    int j = -1;
    char c = s[0];
    string res = "";
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '0' && j == -1) {
            res += ((char)('a'+(((c - 'a') + 1) % k)));

        } else if (t[i] == '1' && j == -1) {
            res = res + s;
            j = 1;

        } else if (t[i] == '0' && j != -1) {
            if (j < s.size())
                j++;
            else{
                j = -1;
                res += ((char)('a'+(((c - 'a') + 1) % k)));
            }
        }else if (t[i] == '1' && j != -1){
            int k ,l;
            for( l =0 ,k = j;k<s.size();k++,l++)
                if(s[k]!=s[l]){
                    cout<<"No solution";
                    return 0;
                }
            res+=s.substr(l);

            j=1;
        }

    }
    vector<int>vc = Z(s+"#"+res);
    for(int i = 0 ; i< t.size();i++){
        if(t[i]=='0'&&vc[i+s.size()+1]>=s.size()){
            cout<<"No solution";
            return 0;
        }
    }
    int y = res.size();
    for(int i = 0; i < (n-y);i++){
        res += ((char)('a'+(((c - 'a') + 1) % k)));
    }
    cout<<res;

    return 0;
}


//============================================================================
// Name        : problems.cpp
// Author      :2shraaf
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <bits/stdc++.h>

using namespace std;
//int Trie::searchWord(int k) {
//	int res = 0;
//    list<Node>le;
//    le.push_front(root);
//
//	while (!le.empty()) {
//		Node current  = le.front();
//		le.pop_front();
//		for (int i = 0; i < current.mChildren.size(); i++) {
//			if(current.mChildren[i]->sum<=k){
//				res++;
//				le.push_front(*current.mChildren[i]);
//
//			}
//
//		}
//	}
//	return res;
//}
//
vector<int> Z_(string str) {
	vector<int> Z(str.size(), 0);
	int L = 0, R = 0;
	for (int i = 1; i < str.size(); i++) {
		if (i > R || Z[i - L] >= R - i + 1) {
			L = i;
			R = max(i, R);
			while (R < str.size() && str[R - L] == str[R])
				R++;
			Z[i] = (R--) - L;
		} else
			Z[i] = Z[i - L];
	}
	Z[0] = str.size();
	return Z;
}

vector<int> Z(string pattern) {
	string s = pattern;
	int n = s.length();
	vector<int> z(n, 0);

	int r = 0, l = 0, i;
	for (int k = 1; k < n; k++) {
		if (k > r) {
			for (i = k; i < n && s[i] == s[i - k]; i++)
				;
			if (i > k) {
				z[k] = i - k;
				l = k;
				r = i - 1;
			}
		} else {
			int kt = k - l, b = r - k + 1;
			if (z[kt] > b) {
				for (i = r + 1; i < n && s[i] == s[i - k]; i++)
					;
				z[k] = i - k;
				l = k;
				r = i - 1;
			}
		}
	}
	return z;
}
int main()

{
	int n, k;
	cin >> n >> k;
	string s, t;
	cin >> s >> t;
	int j = -1;
	char c = s[0];
	string res = "";
	for (int i = 0; i < t.size(); i++) {
		if (t[i] == '0' && j == -1) {
			res += ((char)('a'+(((c - 'a') + 1) % k)));

		} else if (t[i] == '1' && j == -1) {
			res = res + s;
			j = 1;

		} else if (t[i] == '0' && j != -1) {
			if (j < s.size())
				j++;
			else{
				j = -1;
				res += ((char)('a'+(((c - 'a') + 1) % k)));
			}
		}else if (t[i] == '1' && j != -1){
			int k ,l;
			for( l =0 ,k = j;k<s.size();k++,l++)
				if(s[k]!=s[l]){
					cout<<"No solution";
					return 0;
				}
			res+=s.substr(l);
			j=1;
		}

	}
	cout<<res;

	return 0;
}


//============================================================================
// Name        : problems.cpp
// Author      :2shraaf
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <bits/stdc++.h>

using namespace std;
//int Trie::searchWord(int k) {
//  int res = 0;
//    list<Node>le;
//    le.push_front(root);
//
//  while (!le.empty()) {
//      Node current  = le.front();
//      le.pop_front();
//      for (int i = 0; i < current.mChildren.size(); i++) {
//          if(current.mChildren[i]->sum<=k){
//              res++;
//              le.push_front(*current.mChildren[i]);
//
//          }
//
//      }
//  }
//  return res;
//}
//
vector<int> Z(string str) {
    vector<int> Z(str.size(), 0);
    int L = 0, R = 0;
    for (int i = 1; i < str.size(); i++) {
        if (i > R || Z[i - L] >= R - i + 1) {
            L = i;
            R = max(i, R);
            while (R < str.size() && str[R - L] == str[R])
                R++;
            Z[i] = (R--) - L;
        } else
            Z[i] = Z[i - L];
    }
    Z[0] = str.size();
    return Z;
}

int main()

{
    int n, k;
    cin >> n >> k;
    string s, t;
    cin >> s >> t;
    int j = -1;
    char c = s[0];
    string res = "";
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '0' && j == -1) {
            res += ((char)('a'+(((c - 'a') + 1) % k)));

        } else if (t[i] == '1' && j == -1) {
            res = res + s;
            j = 1;

        } else if (t[i] == '0' && j != -1) {
            if (j < s.size())
                j++;
            else{
                j = -1;
                res += ((char)('a'+(((c - 'a') + 1) % k)));
            }
        }else if (t[i] == '1' && j != -1){
            int k ,l;
            for( l =0 ,k = j;k<s.size();k++,l++)
                if(s[k]!=s[l]){
                    cout<<"No solution";
                    return 0;
                }
            res+=s.substr(l);

            j=1;
        }

    }
    vector<int>vc = Z(s+"#"+res);
    for(int i = 0 ; i< t.size();i++){
        if(t[i]=='0'&&vc[i+s.size()+2]>=s.size()){
            cout<<"No solution";
            return 0;
        }
    }
    cout<<res;

    return 0;
}


//============================================================================
// Name        : problems.cpp
// Author      :2shraaf
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <bits/stdc++.h>

using namespace std;
//int Trie::searchWord(int k) {
//  int res = 0;
//    list<Node>le;
//    le.push_front(root);
//
//  while (!le.empty()) {
//      Node current  = le.front();
//      le.pop_front();
//      for (int i = 0; i < current.mChildren.size(); i++) {
//          if(current.mChildren[i]->sum<=k){
//              res++;
//              le.push_front(*current.mChildren[i]);
//
//          }
//
//      }
//  }
//  return res;
//}
//
vector<int> Z(string str) {
    vector<int> Z(str.size(), 0);
    int L = 0, R = 0;
    for (int i = 1; i < str.size(); i++) {
        if (i > R || Z[i - L] >= R - i + 1) {
            L = i;
            R = max(i, R);
            while (R < str.size() && str[R - L] == str[R])
                R++;
            Z[i] = (R--) - L;
        } else
            Z[i] = Z[i - L];
    }
    Z[0] = str.size();
    return Z;
}

int main()

{
    int n, k;
    cin >> n >> k;
    string s, t;
    cin >> s >> t;
    int j = -1;
    char c = s[0];
    string res = "";
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '0' && j == -1) {
            res += ((char)('a'+(((c - 'a') + 1) % k)));

        } else if (t[i] == '1' && j == -1) {
            res = res + s;
            j = 1;

        } else if (t[i] == '0' && j != -1) {
            if (j < s.size())
                j++;
            else{
                j = -1;
                res += ((char)('a'+(((c - 'a') + 1) % k)));
            }
        }else if (t[i] == '1' && j != -1){
            int k ,l;
            for( l =0 ,k = j;k<s.size();k++,l++)
                if(s[k]!=s[l]){
                    cout<<"No solution";
                    return 0;
                }
            res+=s.substr(l);

            j=1;
        }

    }
    vector<int>vc = Z(s+"#"+res);
    for(int i = 0 ; i< t.size();i++){
        if(t[i]=='0'&&vc[i+s.size()+1]>=s.size()){
            cout<<"No solution";
            return 0;
        }
    }
    cout<<res;

    return 0;
}


//============================================================================
// Name        : problems.cpp
// Author      :2shraaf
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <bits/stdc++.h>

using namespace std;
//int Trie::searchWord(int k) {
//  int res = 0;
//    list<Node>le;
//    le.push_front(root);
//
//  while (!le.empty()) {
//      Node current  = le.front();
//      le.pop_front();
//      for (int i = 0; i < current.mChildren.size(); i++) {
//          if(current.mChildren[i]->sum<=k){
//              res++;
//              le.push_front(*current.mChildren[i]);
//
//          }
//
//      }
//  }
//  return res;
//}
//
vector<int> Z(string str) {
    vector<int> Z(str.size(), 0);
    int L = 0, R = 0;
    for (int i = 1; i < str.size(); i++) {
        if (i > R || Z[i - L] >= R - i + 1) {
            L = i;
            R = max(i, R);
            while (R < str.size() && str[R - L] == str[R])
                R++;
            Z[i] = (R--) - L;
        } else
            Z[i] = Z[i - L];
    }
    Z[0] = str.size();
    return Z;
}

int main()

{
    int n, k;
    cin >> n >> k;
    string s, t;
    cin >> s >> t;
    int j = -1;
    char c = s[0];
    string res = "";
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '0' && j == -1) {
            char u = ((char) ('a' + (((c - 'a') + 1) % k)));
            if (res[res.length() - 1] == c && s.size() > 1 && u == s[1])
                res += ((char) ('a' + (((c - 'a') + 2) % k)));
            else
                res += u;

        } else if (t[i] == '1' && j == -1) {
            res = res + s;
            j = 1;

        } else if (t[i] == '0' && j != -1) {
            if (j < s.size())
                j++;
            else {
                j = -1;
                char u = ((char) ('a' + (((c - 'a') + 1) % k)));
                if (res[res.length() - 1] == c && s.size() > 1 && u == s[1])
                    res += ((char) ('a' + (((c - 'a') + 2) % k)));
                else
                    res += u;

            }
        } else if (t[i] == '1' && j != -1) {
            int k, l;
            for (l = 0, k = j; k < s.size(); k++, l++)
                if (s[k] != s[l]) {
                    cout << "No solution";
                    return 0;
                }
            res += s.substr(l);

            j = 1;
        }

    }
    vector<int> vc = Z(s + "#" + res);
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '0' && vc[i + s.size() + 1] >= s.size()) {
            cout << "No solution";
            return 0;
        }
    }
    int y = res.size();
    for (int i = 0; i < (n - y); i++) {
        res += ((char) ('a' + (((c - 'a') + 1) % k)));
    }
    cout << res;

    return 0;
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D2 {
 static char [] a;
 static String s;
 static String name;
 static int n;
 static int k;
    public static void main(String[] args) throws Exception{
        n=in();
        k=in();
        name=str();
        s=str();
        a=new char[n];
        Arrays.fill(a,'#');
        if (!check()){
            System.out.println("No solution");
            return;
        }
        for (int i=0;i<s.length();i++){
            if (s.charAt(i)=='1'){
                boolean x=add(i);
                if (!x){
                    System.out.println("No solution");
                    return;
                }
            }
        }
      //  System.out.println(s.length());
        for (int i=0;i<s.length();i++){
            //System.out.println(i);
            if (s.charAt(i)=='0'){
                //pr();
                boolean x=add2(i);
                //if(i==16)pr();
                if (!x){
                    System.out.println("No solution");
                    return;
                }
            }
        }

        for (char t:a)System.out.print(t=='#'?'a':t);
    }
    private static boolean add2(int start) {
        for (int i=start,m=0;m<name.length();m++,i++){
            if (a[i]=='#'){
                char g=get(m);
                a[i]=g;
                if (g!=name.charAt(m))return true;
            }
            else if (a[i]==name.charAt(m))continue;
            else{
                return true;
            }
        }
        return false;
    }

    private static char get(int m) {
        for (int i=0;i<k;i++){
            char c=(char)('a'+i);
            if (c!=name.charAt(m))return c;
        }
    return  name.charAt(m);
    }
    static void pr(){
         for (char t:a)System.out.print(t);
         System.out.println();
    }
    private static boolean add(int start) {
        for (int i=start,m=0;m<name.length();m++,i++){
            if (a[i]=='#')a[i]=name.charAt(m);
            else if (a[i]==name.charAt(m))continue;
            else{
                return false;
            }
        }
        return true;
    }
    private static boolean check() {
        for (int i=0;i<name.length();i++){
            if (name.charAt(i)-'a'>k-1)return false;
        }
        return true;
    }
    static BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static int in() throws IOException{
        if (st==null || !st.hasMoreTokens()){
            st=new StringTokenizer(buf.readLine());
        }
        return Integer.parseInt(st.nextToken());
    }
    static long ll() throws IOException{
        if (st==null || !st.hasMoreTokens()){
            st=new StringTokenizer(buf.readLine());
        }
        return Long.parseLong(st.nextToken());
    }
    static String str() throws IOException{
        if (st==null || !st.hasMoreTokens()){
            st=new StringTokenizer(buf.readLine());
        }
        return (st.nextToken());
    }
        static double dub() throws IOException{
            if (st==null || !st.hasMoreTokens()){
                st=new StringTokenizer(buf.readLine());
            }
            return Double.parseDouble(st.nextToken());
    }
}


	import java.io.*;
import java.math.*;
import java.nio.file.attribute.AclEntry.Builder;
import java.security.KeyStore.Entry;
import java.util.*;

	public  class Khatri {
		private InputStream is;
		private PrintWriter out;
		int time = 0, val[][], dp[][], DP[], start[], end[], dist[],  black[], MOD = (int)(1e9+7), arr[], weight[][], x[], y[], parent[];
		int MAX = 800000, N, K, L;
		long red[];
		ArrayList<Integer>[] amp;
		//boolean b[], boo[][];
		Pair prr[];
		HashSet<Integer> hs = new HashSet<>();
		long Dp[][][][] = new long[110][110][12][12];

		public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
			public void run() {
				try {

			//new CODEFORCES().soln();
			} catch (Exception e) {
					System.out.println(e);
				}
			}
		}, "1", 1 << 26).start();
			new Khatri().soln();
		}
		char ch[][];
		int ans = 0, cnt = 0, Q;
		int n1, n2, k1, k2, M;
		static int a[]=new int[100005];		static int b[]=new int[100005];
		void solve() {
			int n=ni();
			int k=ni();
			String s=ns();
			boolean bl[]=new boolean[26];
			for(int i=0;i<s.length();i++)
				bl[s.charAt(i)-'a']=true;
			int count=0;
			char tmp='-';
			for(char c='a';c<='z';c++)
			{
				if(count<k)
				{
					if(!bl[c-'a'])
					{
					tmp=c;
					break;
					}
				}
				count++;
			}
			String p=ns();
			char ans[]=new char[n];
			Arrays.fill(ans,'-');
			for(int i=0;i<p.length();i++)
			{
				if(p.charAt(i)=='1')
				{
					int curr=i;
					for(int j=0;j<s.length();j++)
					{
						if(ans[curr]!='-'&&ans[curr]!=s.charAt(j))
						{
							out.println("No solution");
							return;
						}
						ans[curr++]=s.charAt(j);
					}
				}
			}
			if(tmp=='-')
				tmp='b';
			for(int i=0;i<n;i++)
				if(ans[i]=='-')
					ans[i]=tmp;
			for(int i=0;i<n-s.length()+1;i++)
			{
				int cp=0;int curr=i;
                for(int j=0;j<s.length();j++)
                {
                	if(s.charAt(j)==ans[curr])
                	{
                		cp++;
                	}
                	curr++;
                }
                if(cp==s.length()&&p.charAt(i)=='0')
                {
                	out.print("No solution");
                	return;
                }
			}
			out.println(new String(ans));
		}
		boolean isPrime(int x){
			for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;
			return true;
		}
	    int  p ;
		void buildGraph(int n)
		{
			for(int i = 0; i<n ;i++){
				int x1 = ni() -1, y1 = ni()-1;
				amp[x1].add(y1);
				amp[y1].add(x1);
				x[i] = x1; y[i] = y1;
			}
		}
		long get(int x){
			long val = 0;
			for(int i = 0; i< N; i++){
				val += Math.abs(x-arr[i]);
				x+=L;
			}
			return val;
		}

		long modInverse(long a, long mOD2){
	        return  power(a, mOD2-2, mOD2);
		}
		long power(long x, long y, long m)
		{
			if (y == 0)
	    return 1;
		long p = power(x, y/2, m) % m;
		p = (p * p) % m;

		return (y%2 == 0)? p : (x * p) % m;
		}

		public long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}

		public static int[] shuffle(int[] a, Random gen){
			for(int i = 0, n = a.length;i < n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
		return a;
		}

		class Pair implements Comparable<Pair>{
			int u, v, i;
			Pair(int u, int v){
				this.u = u;
				this.v = v;
			}
			Pair(int u, int v, int i){
				this.u = u;
				this.v = v;
				this.i = i;
			}
			public int hashCode() {
				return Objects.hash();
			}
			/*public boolean equals(Object o) {
				Pair other = (Pair) o;
				return ((u == other.u && v == other.v) || (v == other.u && u == other.v));
			}*/
			public int compareTo(Pair other) {
				//return Integer.compare(val, other.val);
				return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(v,other.v));
			}
			public String toString(){
				return this.u +" " + this.v;
			}
		}
		long power(long x, long y, int mod){
			long ans = 1;
			while(y>0){
				if(y%2==0){
					x = (x*x)%mod;
					y/=2;
				}
				else{
					ans = (x*ans)%mod;
					y--;
				}
			}
			return ans;
		}
		void soln() {
			is = System.in;
			out = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			//out.close();
			out.flush();
			//tr(System.currentTimeMillis() - s + "ms");
		}

		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}
		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

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

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o) {
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}


	import java.io.*;
import java.math.*;
import java.nio.file.attribute.AclEntry.Builder;
import java.security.KeyStore.Entry;
import java.util.*;

	public  class Khatri {
		private InputStream is;
		private PrintWriter out;
		int time = 0, val[][], dp[][], DP[], start[], end[], dist[],  black[], MOD = (int)(1e9+7), arr[], weight[][], x[], y[], parent[];
		int MAX = 800000, N, K, L;
		long red[];
		ArrayList<Integer>[] amp;
		//boolean b[], boo[][];
		Pair prr[];
		HashSet<Integer> hs = new HashSet<>();
		long Dp[][][][] = new long[110][110][12][12];

		public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
			public void run() {
				try {

			//new CODEFORCES().soln();
			} catch (Exception e) {
					System.out.println(e);
				}
			}
		}, "1", 1 << 26).start();
			new Khatri().soln();
		}
		char ch[][];
		int ans = 0, cnt = 0, Q;
		int n1, n2, k1, k2, M;
		static int a[]=new int[100005];		static int b[]=new int[100005];
		void solve() {
			int n=ni();
			int k=ni();
			String s=ns();
			boolean bl[]=new boolean[26];
			for(int i=0;i<s.length();i++)
				bl[s.charAt(i)-'a']=true;

			String p=ns();
			char ans[]=new char[n];
			Arrays.fill(ans,'-');
			for(int i=0;i<p.length();i++)
			{
				if(p.charAt(i)=='1')
				{
					int curr=i;
					for(int j=0;j<s.length();j++)
					{
						if(ans[curr]!='-'&&ans[curr]!=s.charAt(j))
						{
							out.println("No solution");
							return;
						}
						ans[curr++]=s.charAt(j);
					}
				}
			}
			int count=0;
			for(char c='a';c<='z';c++){
				if(count<k){
				for(int i=0;i<n;i++)
				{
				 if(ans[i]=='-')
					 ans[i]=c;
				}
			boolean bool=true;
			for(int i=0;i<n-s.length()+1;i++)
			{
				int cp=0;int curr=i;
                for(int j=0;j<s.length();j++)
                {
                	if(s.charAt(j)==ans[curr])
                	{
                		cp++;
                	}
                	curr++;
                }
                if(cp==s.length()&&p.charAt(i)=='0')
                {
                bool=false;break;
                }
			}
			if(bool){
				out.println(new String(ans));
			    return;
			}
				}
				count++;
			}
			out.println("No solution");
		}
		boolean isPrime(int x){
			for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;
			return true;
		}
	    int  p ;
		void buildGraph(int n)
		{
			for(int i = 0; i<n ;i++){
				int x1 = ni() -1, y1 = ni()-1;
				amp[x1].add(y1);
				amp[y1].add(x1);
				x[i] = x1; y[i] = y1;
			}
		}
		long get(int x){
			long val = 0;
			for(int i = 0; i< N; i++){
				val += Math.abs(x-arr[i]);
				x+=L;
			}
			return val;
		}

		long modInverse(long a, long mOD2){
	        return  power(a, mOD2-2, mOD2);
		}
		long power(long x, long y, long m)
		{
			if (y == 0)
	    return 1;
		long p = power(x, y/2, m) % m;
		p = (p * p) % m;

		return (y%2 == 0)? p : (x * p) % m;
		}

		public long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}

		public static int[] shuffle(int[] a, Random gen){
			for(int i = 0, n = a.length;i < n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
		return a;
		}

		class Pair implements Comparable<Pair>{
			int u, v, i;
			Pair(int u, int v){
				this.u = u;
				this.v = v;
			}
			Pair(int u, int v, int i){
				this.u = u;
				this.v = v;
				this.i = i;
			}
			public int hashCode() {
				return Objects.hash();
			}
			/*public boolean equals(Object o) {
				Pair other = (Pair) o;
				return ((u == other.u && v == other.v) || (v == other.u && u == other.v));
			}*/
			public int compareTo(Pair other) {
				//return Integer.compare(val, other.val);
				return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(v,other.v));
			}
			public String toString(){
				return this.u +" " + this.v;
			}
		}
		long power(long x, long y, int mod){
			long ans = 1;
			while(y>0){
				if(y%2==0){
					x = (x*x)%mod;
					y/=2;
				}
				else{
					ans = (x*ans)%mod;
					y--;
				}
			}
			return ans;
		}
		void soln() {
			is = System.in;
			out = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			//out.close();
			out.flush();
			//tr(System.currentTimeMillis() - s + "ms");
		}

		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}
		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

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

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o) {
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}


	import java.io.*;
import java.math.*;
import java.nio.file.attribute.AclEntry.Builder;
import java.security.KeyStore.Entry;
import java.util.*;

	public  class Khatri {
		private InputStream is;
		private PrintWriter out;
		int time = 0, val[][], dp[][], DP[], start[], end[], dist[],  black[], MOD = (int)(1e9+7), arr[], weight[][], x[], y[], parent[];
		int MAX = 800000, N, K, L;
		long red[];
		ArrayList<Integer>[] amp;
		//boolean b[], boo[][];
		Pair prr[];
		HashSet<Integer> hs = new HashSet<>();
		long Dp[][][][] = new long[110][110][12][12];

		public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
			public void run() {
				try {

			//new CODEFORCES().soln();
			} catch (Exception e) {
					System.out.println(e);
				}
			}
		}, "1", 1 << 26).start();
			new Khatri().soln();
		}
		char ch[][];
		int ans = 0, cnt = 0, Q;
		int n1, n2, k1, k2, M;
		static int a[]=new int[100005];		static int b[]=new int[100005];
		void solve() {
			int n=ni();
			int k=ni();
			String s=ns();
			boolean bl[]=new boolean[26];
			for(int i=0;i<s.length();i++)
				bl[s.charAt(i)-'a']=true;

			String p=ns();
			char ans[]=new char[n];
			Arrays.fill(ans,'-');
			for(int i=0;i<p.length();i++)
			{
				if(p.charAt(i)=='1')
				{
					int curr=i;
					for(int j=0;j<s.length();j++)
					{
						if(ans[curr]!='-'&&ans[curr]!=s.charAt(j))
						{
							out.println("No solution");
							return;
						}
						ans[curr++]=s.charAt(j);
					}
				}
			}
			int count=0;
			for(char c='a';c<='z';c++){
				if(count<k){
					char tmp[]=Arrays.copyOf(ans,n);
				for(int i=0;i<n;i++)
				{
				 if(tmp[i]=='-')
					 tmp[i]=c;
				}
			boolean bool=true;
			for(int i=0;i<n-s.length()+1;i++)
			{
				int cp=0;int curr=i;
                for(int j=0;j<s.length();j++)
                {
                	if(s.charAt(j)==tmp[curr])
                	{
                		cp++;
                	}
                	curr++;
                }
                if(cp==s.length()&&p.charAt(i)=='0')
                {
                bool=false;
                break;
                }
			}

			if(bool){
				out.println(new String(tmp));
			    return;
			}
				}
				count++;
			}
			out.println("No solution");
		}
		boolean isPrime(int x){
			for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;
			return true;
		}
	    int  p ;
		void buildGraph(int n)
		{
			for(int i = 0; i<n ;i++){
				int x1 = ni() -1, y1 = ni()-1;
				amp[x1].add(y1);
				amp[y1].add(x1);
				x[i] = x1; y[i] = y1;
			}
		}
		long get(int x){
			long val = 0;
			for(int i = 0; i< N; i++){
				val += Math.abs(x-arr[i]);
				x+=L;
			}
			return val;
		}

		long modInverse(long a, long mOD2){
	        return  power(a, mOD2-2, mOD2);
		}
		long power(long x, long y, long m)
		{
			if (y == 0)
	    return 1;
		long p = power(x, y/2, m) % m;
		p = (p * p) % m;

		return (y%2 == 0)? p : (x * p) % m;
		}

		public long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}

		public static int[] shuffle(int[] a, Random gen){
			for(int i = 0, n = a.length;i < n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
		return a;
		}

		class Pair implements Comparable<Pair>{
			int u, v, i;
			Pair(int u, int v){
				this.u = u;
				this.v = v;
			}
			Pair(int u, int v, int i){
				this.u = u;
				this.v = v;
				this.i = i;
			}
			public int hashCode() {
				return Objects.hash();
			}
			/*public boolean equals(Object o) {
				Pair other = (Pair) o;
				return ((u == other.u && v == other.v) || (v == other.u && u == other.v));
			}*/
			public int compareTo(Pair other) {
				//return Integer.compare(val, other.val);
				return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(v,other.v));
			}
			public String toString(){
				return this.u +" " + this.v;
			}
		}
		long power(long x, long y, int mod){
			long ans = 1;
			while(y>0){
				if(y%2==0){
					x = (x*x)%mod;
					y/=2;
				}
				else{
					ans = (x*ans)%mod;
					y--;
				}
			}
			return ans;
		}
		void soln() {
			is = System.in;
			out = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			//out.close();
			out.flush();
			//tr(System.currentTimeMillis() - s + "ms");
		}

		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}
		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

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

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o) {
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}


	import java.io.*;
import java.math.*;
import java.nio.file.attribute.AclEntry.Builder;
import java.security.KeyStore.Entry;
import java.util.*;

	public  class Khatri {
		private InputStream is;
		private PrintWriter out;
		int time = 0, val[][], dp[][], DP[], start[], end[], dist[],  black[], MOD = (int)(1e9+7), arr[], weight[][], x[], y[], parent[];
		int MAX = 800000, N, K, L;
		long red[];
		ArrayList<Integer>[] amp;
		//boolean b[], boo[][];
		Pair prr[];
		HashSet<Integer> hs = new HashSet<>();
		long Dp[][][][] = new long[110][110][12][12];

		public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
			public void run() {
				try {

			//new CODEFORCES().soln();
			} catch (Exception e) {
					System.out.println(e);
				}
			}
		}, "1", 1 << 26).start();
			new Khatri().soln();
		}
		char ch[][];
		int ans = 0, cnt = 0, Q;
		int n1, n2, k1, k2, M;
		static int a[]=new int[100005];		static int b[]=new int[100005];
		void solve() {
			int n=ni();
			int k=ni();
			String s=ns();
			boolean bl[]=new boolean[26];
			for(int i=0;i<s.length();i++)
				bl[s.charAt(i)-'a']=true;
			int count=0;
			char tmp='-';
			for(char c='a';c<='z';c++)
			{
				if(count<k)
				{
					if(!bl[c-'a'])
					{
					tmp=c;
					break;
					}
				}
				count++;
			}
			String p=ns();
			char ans[]=new char[n];
			Arrays.fill(ans,'-');
			for(int i=0;i<p.length();i++)
			{
				if(p.charAt(i)=='1')
				{
					int curr=i;
					for(int j=0;j<s.length();j++)
					{
						if(ans[curr]!='-'&&ans[curr]!=s.charAt(j))
						{
							out.println("No Solution");
							return;
						}
						ans[curr++]=s.charAt(j);
					}
				}
			}
			if(tmp=='-')
				tmp='a';
			for(int i=0;i<n;i++)
				if(ans[i]=='-')
					ans[i]=tmp;
			out.println(new String(ans));
		}
		boolean isPrime(int x){
			for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;
			return true;
		}
	    int  p ;
		void buildGraph(int n)
		{
			for(int i = 0; i<n ;i++){
				int x1 = ni() -1, y1 = ni()-1;
				amp[x1].add(y1);
				amp[y1].add(x1);
				x[i] = x1; y[i] = y1;
			}
		}
		long get(int x){
			long val = 0;
			for(int i = 0; i< N; i++){
				val += Math.abs(x-arr[i]);
				x+=L;
			}
			return val;
		}

		long modInverse(long a, long mOD2){
	        return  power(a, mOD2-2, mOD2);
		}
		long power(long x, long y, long m)
		{
			if (y == 0)
	    return 1;
		long p = power(x, y/2, m) % m;
		p = (p * p) % m;

		return (y%2 == 0)? p : (x * p) % m;
		}

		public long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}

		public static int[] shuffle(int[] a, Random gen){
			for(int i = 0, n = a.length;i < n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
		return a;
		}

		class Pair implements Comparable<Pair>{
			int u, v, i;
			Pair(int u, int v){
				this.u = u;
				this.v = v;
			}
			Pair(int u, int v, int i){
				this.u = u;
				this.v = v;
				this.i = i;
			}
			public int hashCode() {
				return Objects.hash();
			}
			/*public boolean equals(Object o) {
				Pair other = (Pair) o;
				return ((u == other.u && v == other.v) || (v == other.u && u == other.v));
			}*/
			public int compareTo(Pair other) {
				//return Integer.compare(val, other.val);
				return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(v,other.v));
			}
			public String toString(){
				return this.u +" " + this.v;
			}
		}
		long power(long x, long y, int mod){
			long ans = 1;
			while(y>0){
				if(y%2==0){
					x = (x*x)%mod;
					y/=2;
				}
				else{
					ans = (x*ans)%mod;
					y--;
				}
			}
			return ans;
		}
		void soln() {
			is = System.in;
			out = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			//out.close();
			out.flush();
			//tr(System.currentTimeMillis() - s + "ms");
		}

		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}
		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

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

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o) {
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}


	import java.io.*;
import java.math.*;
import java.nio.file.attribute.AclEntry.Builder;
import java.security.KeyStore.Entry;
import java.util.*;

	public  class Khatri {
		private InputStream is;
		private PrintWriter out;
		int time = 0, val[][], dp[][], DP[], start[], end[], dist[],  black[], MOD = (int)(1e9+7), arr[], weight[][], x[], y[], parent[];
		int MAX = 800000, N, K, L;
		long red[];
		ArrayList<Integer>[] amp;
		//boolean b[], boo[][];
		Pair prr[];
		HashSet<Integer> hs = new HashSet<>();
		long Dp[][][][] = new long[110][110][12][12];

		public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
			public void run() {
				try {

			//new CODEFORCES().soln();
			} catch (Exception e) {
					System.out.println(e);
				}
			}
		}, "1", 1 << 26).start();
			new Khatri().soln();
		}
		char ch[][];
		int ans = 0, cnt = 0, Q;
		int n1, n2, k1, k2, M;
		static int a[]=new int[100005];		static int b[]=new int[100005];
		void solve() {
			int n=ni();
			int k=ni();
			String s=ns();
			boolean bl[]=new boolean[26];
			for(int i=0;i<s.length();i++)
				bl[s.charAt(i)-'a']=true;
			int count=0;
			char tmp='-';
			for(char c='a';c<='z';c++)
			{
				if(count<k)
				{
					if(!bl[c-'a'])
					{
					tmp=c;
					break;
					}
				}
				count++;
			}
			String p=ns();
			char ans[]=new char[n];
			Arrays.fill(ans,'-');
			for(int i=0;i<p.length();i++)
			{
				if(p.charAt(i)=='1')
				{
					int curr=i;
					for(int j=0;j<s.length();j++)
					{
						if(ans[curr]!='-'&&ans[curr]!=s.charAt(j))
						{
							out.println("No solution");
							return;
						}
						ans[curr++]=s.charAt(j);
					}
				}
			}
			if(tmp=='-')
				tmp='b';
			for(int i=0;i<n;i++)
				if(ans[i]=='-')
					ans[i]=tmp;
			out.println(new String(ans));
		}
		boolean isPrime(int x){
			for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;
			return true;
		}
	    int  p ;
		void buildGraph(int n)
		{
			for(int i = 0; i<n ;i++){
				int x1 = ni() -1, y1 = ni()-1;
				amp[x1].add(y1);
				amp[y1].add(x1);
				x[i] = x1; y[i] = y1;
			}
		}
		long get(int x){
			long val = 0;
			for(int i = 0; i< N; i++){
				val += Math.abs(x-arr[i]);
				x+=L;
			}
			return val;
		}

		long modInverse(long a, long mOD2){
	        return  power(a, mOD2-2, mOD2);
		}
		long power(long x, long y, long m)
		{
			if (y == 0)
	    return 1;
		long p = power(x, y/2, m) % m;
		p = (p * p) % m;

		return (y%2 == 0)? p : (x * p) % m;
		}

		public long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}

		public static int[] shuffle(int[] a, Random gen){
			for(int i = 0, n = a.length;i < n;i++)
			{
				int ind = gen.nextInt(n-i)+i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
		return a;
		}

		class Pair implements Comparable<Pair>{
			int u, v, i;
			Pair(int u, int v){
				this.u = u;
				this.v = v;
			}
			Pair(int u, int v, int i){
				this.u = u;
				this.v = v;
				this.i = i;
			}
			public int hashCode() {
				return Objects.hash();
			}
			/*public boolean equals(Object o) {
				Pair other = (Pair) o;
				return ((u == other.u && v == other.v) || (v == other.u && u == other.v));
			}*/
			public int compareTo(Pair other) {
				//return Integer.compare(val, other.val);
				return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(v,other.v));
			}
			public String toString(){
				return this.u +" " + this.v;
			}
		}
		long power(long x, long y, int mod){
			long ans = 1;
			while(y>0){
				if(y%2==0){
					x = (x*x)%mod;
					y/=2;
				}
				else{
					ans = (x*ans)%mod;
					y--;
				}
			}
			return ans;
		}
		void soln() {
			is = System.in;
			out = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			//out.close();
			out.flush();
			//tr(System.currentTimeMillis() - s + "ms");
		}

		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}
		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

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

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o) {
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}