for _ in range(int(input())):
    n, m = map(int, input().split())
    a = [int(input(), 2) for _ in range(n)]
    x = (2 ** m - n - 1) // 2
    for v in sorted(a):
        if v <= x:
            x += 1
    print("{0:0={1}b}".format(x, m))


from collections import defaultdict as dd
for _ in range(int(input())):
    n,m=map(int,input().split())
    med=(1<<m-1)-1
    num=dd(int)
    for i in range(n):
        d=int(input(),2)
        num[d]=1
        if i%2:
            x=med-1
            if d>=med:
                while num[x]:
                    x-=1
                med=x
        else:
            x=med+1
            if d<=med:
                while num[x]:
                    x+=1
                med=x
    print(bin(med)[2:].zfill(m))


from bisect import bisect as bc
t=int(input())
for _ in range(t):
    n,m=map(int,input().split())
    ar=[i for i in range(pow(2,m))]
    for i in range(n):
        ar.remove(int(input(),2))
    print(bin(ar[(len(ar)-1)//2])[2:].zfill(m))


from math import log

t = int(input())

for _ in range(t):
    n, m = map(int, input().split())
    a = []

    for i in range(n):
        a.append(input())

    init = (2**m - 1)//2
    seen = set()

    for i in a:
        bi = "0"*(m-len(bin(init)[2:])) + bin(init)[2:]

#         print(init)

        if (2**m - len(seen))%2:
            if i >= bi:
                j = init-1
                while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
                    j -= 1
                init = j
        else:
            if i <= bi:
                j = init+1
                while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
                    j += 1
                init = j

        seen.add(i)

    print("0"*(m-len(bin(init)[2:])) + bin(init)[2:])


from math import log

t = int(input())

for _ in range(t):
    n, m = map(int, input().split())
    a = []

    for i in range(n):
        a.append(input())

    init = (2**m - 1)//2
    seen = set()

    for i in a:
        bi = "0"*(m-len(bin(init)[2:])) + bin(init)[2:]

        print(init)

        if (2**m - len(seen))%2:
            if i >= bi:
                j = init-1
                while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
                    j -= 1
                init = j
        else:
            if i <= bi:
                j = init+1
                while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
                    j += 1
                init = j

#         print(init, upd1, upd2)
#         if bi < i:
#             upd1 += 1
#             upd2 = 0

#             if upd1 == 2:
#                 upd1 = 0
#                 j = init-1
#                 while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
#                     j -= 1

#                 init = j

#         elif bi > i:
#             upd2 += 1
#             upd1 = 0

#             if upd2 == 2:
#                 upd2 = 0
#                 j = init+1
#                 while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
#                     j += 1

#                 init = j

#         else:
#             if (2**m - len(seen))%2:
#                 j = init-1
#                 while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
#                     j -= 1

#                 init = j
#             else:
#                 j = init+1
#                 while "0"*(m-len(bin(j)[2:])) + bin(j)[2:] in seen:
#                     j += 1

#                 init = j

        seen.add(i)

    print("0"*(m-len(bin(init)[2:])) + bin(init)[2:])


#import math
#from functools import lru_cache
#import heapq
#from collections import defaultdict
#from collections import Counter
#from sys import stdout
#from sys import setrecursionlimit
from sys import stdin
input = stdin.readline
for Ti in range(int(input().strip())):
    n, m = [int(x) for x in input().strip().split()]
    tc = 2**m
    mc = (tc - n+1)//2
    a = []
    for ni in range(n):
        a.append(int(input().strip(), 2))
    a.sort()
    a.append(tc)
    ne = a[0]
    ns = -1
    ci = 0
    while ci<len(a):
        #print(ns, ne, mc)
        cc = (ne-ns-1)
        if(mc-cc<=0):
            ans = ns + mc
            break
        mc -= cc
        ci+=1
        ns = ne
        ne = a[ci]
    print(bin(ans)[2:].zfill(m))


def cast(now):
    if now == 0:
        return ''
    return cast(now // 2) + str(now % 2)

def is_mediana(all_numbers, num, a):
    if num in a:
        return False
    left = num
    right = all_numbers - num - 1
    for i in a:
        if i < num:
            left -= 1
        else:
            right -= 1
    return left == right or left + 1 == right

for _ in range(int(input())):
    n, m = map(int, input().split())
    a = [int(input(), 2) for i in range(n)]
    now = (2**m - n - 1) // 2
    for i in range(100):
        if now - i >= 0 and is_mediana(2**m, now - i, a):
            ans = cast(now - i)
            ans = '0' * (m - len(ans)) + ans
            print(ans)
            break
        elif now + i < 2**m and is_mediana(2**m, now + i, a):
            ans = cast(now + i)
            ans = '0' * (m - len(ans)) + ans
            print(ans)
            break
    # print(now)


from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))

def solve(n, m, strings):
    strings = set(strings)
    median = pow(2, m-1)
    while median in strings:
        median += 1
    counts_lower = median
    for string in strings:
        if string < median:
            counts_lower -= 1
    needed_lower = (pow(2, m) - 1 - n) // 2
    while counts_lower != needed_lower:
        if counts_lower < needed_lower:
            median += 1
            if median not in strings:
                counts_lower += 1
        else:
            median -= 1
            if median not in strings:
                counts_lower -= 1

    return convert_to_binary_string_of_length(m, median)

def convert_to_binary_string_of_length(m, median):
    median = bin(median)[2:]
    median = ("0" * m) + median
    return median[len(median) - m:]

if __name__ == "__main__":
    for i in tests():
        n, m = arr_in()
        strings = [int(str_in(), 2) for x in range(n)]
        out(solve(n, m, strings))


import kotlin.math.min
import kotlin.math.max
import kotlin.math.sqrt

private fun cin_ch() = readLine()!!.split(" ").map{it.toInt()}
private fun cin_string() = readLine()!!.split(" ")
private fun cin_array() = readLine()!!.split(" ").map(String::toInt)

fun main() {
    var test = cin_ch()[0];
    while (test>0) {
        val (n,m) = cin_ch();
        var ABRACADABRA = m.toLong();
        var myArray = ArrayList<String> ();
        for (i in 0..n-1) {
            var x = cin_string()[0];
            myArray.add(x);
        }
        var stepen : Long = 1;
        var korova = 0;
        while (korova<m) {
            stepen = stepen * 2;
            korova = korova + 1;
        }
        myArray.sort();
        var myArray2 = ArrayList<Long> ();
        for (i in 0..n-1) {
            var x = myArray[i];
            var xx : Long = stepen / 2;
            var chiselko : Long = 0;
            for (j in 0..m-1)
            {
                var dobav : Long = 0;
                if (x[j]=='1') dobav = dobav + xx;
                xx = xx / 2;
                chiselko = chiselko + dobav;
            }
            myArray2.add(chiselko);
        }
        var answ : Long = 0;
        var left : Long = -1;
        var right : Long = stepen + 50;
        var cur : Long = (stepen - n);
        cur = (cur/2) + (cur%2);
        while (left + 1 < right) {
            var mid : Long = (left+right)/2;
            var left2 = -1;
            var right2  = n;
            var gran = 0;
            while (left2+1<right2)
            {
                var mid2 = (left2+right2)/2;
                if (myArray2[mid2]<=mid)
                {gran = mid2 + 1;
                left2 = mid2;}
                else right2 = mid2;
            }
            var znac : Long = mid - gran;
            if (znac>=cur-1) {answ = mid;right = mid;}
            else left = mid;
        }
        var answ2 = answ;
        var ans = "";
        var sz = 0;
        while (answ>0) {
        var zv:Long = answ % 2;
        if (zv>0) ans = ans + '1';
        else ans = ans + '0';
        sz = sz + 1;
            answ = answ / 2;
        }
            while (sz<m) {
                ans = ans + '0';
                sz = sz + 1;
            }
            var point = m - 1;
            while (point>=0) {
                print(ans[point]);
                point = point - 1;
            }
            println();
        test = test - 1;
    }
}


import java.util.*
import java.math.*
import kotlin.math.*

fun readLn()=readLine()!!
fun readInt()=readLn().toInt()
fun readInts()=readLn().split(" ").map{it.toInt()}
fun readLong()=readLn().toLong()
fun readLongs()=readLn().split(" ").map{it.toLong()}

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun ArrayList<Long>.get_lo(x:Long):Int{
    var idx=this.binarySearch(x)
    if(idx>=0)return idx+1
    else return -idx-1
}
fun Long.toBinaryString(m:Int):String{
    var ans="";var tmp=this
    repeat(m){ans=('0'+(tmp%2).toInt())+ans;tmp/=2}
    return ans
}
fun main(){
    val t=readInt()
    repeat(t){
        var (n,m)=readInts()
        var a=ArrayList<Long>()
        fun make(str:String):Long{
            var ans=0L
            for(i in str)ans=ans*2+(i-'0')
            return ans
        }
        repeat(n){a.add(make(readLn()))}
        a.sort()
        var lo=((1L shl m)-n-1)/2
        var top=(1L shl m)-1;var bot=0L;var pos=-1L
        while(top>=bot){
            var mid=(top+bot)/2
            var cnt=mid+1-a.get_lo(mid)
            if(cnt<=lo){pos=mid;bot=mid+1}
            else top=mid-1
        }
        printLine((pos+1).toBinaryString(m))
    }
    output()
}


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

object Main {
    var `in`: IO? = null
    var out: PrintWriter? = null

    @Throws(Exception::class)
    fun init_io(filename: String) {
        if (filename == "") {
            `in` = IO(System.`in`)
            out = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)), true)
        } else {
            `in` = IO(FileInputStream("$filename.in"))
            out = PrintWriter(BufferedWriter(FileWriter("$filename.out")), true)
        }
    }

    const val mod: Long = 998244353

    /*
fun main(args: Array<String>) {
    Main.main(args);
}
*/
    @Throws(Exception::class)
    fun solve(tc: Int) {
        val n = `in`!!.nint()
        val m = `in`!!.nint()
        val s = arrayOfNulls<String>(n)
        for (i in 0 until n) s[i] = `in`!!.nstr()
        Arrays.sort(s)
        val tot = (1L shl m) - 1
        var cur = tot / 2
        val req = (tot - n) / 2
        var c = "0"
        for (i in 0 until m - 1) c += "1"
        var pt: Int
        pt = 0
        while (pt < n) {
            if (c.compareTo(s[pt]!!) < 0) break
            --cur
            pt++
        }

        // out.println(cur + " " + req + " " + pt);
        if (cur > req) {
            --pt
            while (cur > req) {
                if (pt >= 0 && c.compareTo(s[pt]!!) == 0) {
                    --pt
                } else {
                    --cur
                    if (cur == req) break
                }
                c = sub(c)
            }
        }
        if (cur == req) {
            --pt
            while (pt >= 0 && pt < n && c.compareTo(s[pt]!!) == 0) {
                c = sub(c)
                --pt
            }
        }
        while (cur < req) {
            c = ad(c)
            if (pt < n && c.compareTo(s[pt]!!) == 0) {
                ++pt
            } else {
                ++cur
            }
        }
        out!!.println(c)
    }

    fun ad(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '0') {
                    nxt[i] = '1'
                    carry = false
                } else nxt[i] = '0'
            }
        }
        return from(nxt)
    }

    fun sub(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '1') {
                    nxt[i] = '0'
                    carry = false
                } else nxt[i] = '1'
            }
        }
        return from(nxt)
    }

    fun from(c: CharArray): String {
        val sb = StringBuilder()
        for (i in c.indices) sb.append(c[i])
        return sb.toString()
    }

    @Throws(Exception::class)
    @JvmStatic
    fun main(_u_n_u_s_e_d_: Array<String>) {
        init_io("")
        var t = 1
        t = `in`!!.nint()
        for (tc in 0 until t) {
            solve(tc)
        }
    }

    fun minv(v: Long): Long {
        return mpow(v, mod - 2)
    }

    fun mpow(base: Long, exp: Long): Long {
        var base = base
        var exp = exp
        var res: Long = 1
        while (exp > 0) {
            if (exp and 1 == 1L) {
                res = res * base % mod
            }
            base = base * base % mod
            exp = exp shr 1
        }
        return res
    }

    fun gcd(x: Long, y: Long): Long {
        return if (x == 0L) y else gcd(y % x, x)
    }

    fun rsort(arr: LongArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    fun rsort(arr: IntArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    /* static void qsort(long[] arr) {
    Long[] oarr = new Long[arr.length];
    for (int i = 0; i < arr.length; i++) {
      oarr[i] = arr[i];
    }

    ArrayList<Long> alist = new ArrayList<Long>(Arrays.asList(oarr));
    Collections.sort(alist);

    for (int i = 0; i < arr.length; i++) {
      arr[i] = (long)alist.get(i);
    }
  } */
    fun reverse(arr: LongArray) {
        for (i in 0 until arr.size / 2) {
            val temp = arr[i]
            arr[i] = arr[arr.size - 1 - i]
            arr[arr.size - 1 - i] = temp
        }
    }

    fun atos(arr: LongArray?): String {
        var s = Arrays.toString(arr)
        s = s.substring(1, s.length - 1)
        return s.replace(",", "")
    }

    class IO(x: InputStream?) {
        var `in`: BufferedReader
        var tokens: StringTokenizer

        @Throws(Exception::class)
        fun nint(): Int {
            return nstr().toInt()
        }

        @Throws(Exception::class)
        fun nlong(): Long {
            return nstr().toLong()
        }

        @Throws(Exception::class)
        fun ndouble(): Double {
            return nstr().toDouble()
        }

        @Throws(Exception::class)
        fun nstr(): String {
            if (!tokens.hasMoreTokens()) tokens = StringTokenizer(`in`.readLine())
            return tokens.nextToken()
        }

        @Throws(Exception::class)
        fun nla(n: Int): LongArray {
            val arr = LongArray(n)
            for (i in 0 until n) {
                arr[i] = nlong()
            }
            return arr
        }

        init {
            `in` = BufferedReader(InputStreamReader(x))
            tokens = StringTokenizer(`in`.readLine())
        }
    }

    internal class Pair<A : Comparable<A>?, B : Comparable<B>?>(var f: A, var s: B) : Comparable<Pair<A, B>> {
        override fun compareTo(other: Pair<A, B>): Int {
            val v = f!!.compareTo(other.f)
            return if (v != 0) v else s!!.compareTo(other.s)
        }

        override fun toString(): String {
            return "(" + f.toString() + ", " + s.toString() + ")"
        }

    }
}

fun main(args: Array<String>) {
    Main.main(args);
}


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

object Main {
    var `in`: IO? = null
    var out: PrintWriter? = null

    @Throws(Exception::class)
    fun init_io(filename: String) {
        if (filename == "") {
            `in` = IO(System.`in`)
            out = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)), true)
        } else {
            `in` = IO(FileInputStream("$filename.in"))
            out = PrintWriter(BufferedWriter(FileWriter("$filename.out")), true)
        }
    }

    const val mod: Long = 998244353

    /*
fun main(args: Array<String>) {
    Main.main(args);
}
*/
    @Throws(Exception::class)
    fun solve(tc: Int) {
        val n = `in`!!.nint()
        val m = `in`!!.nint()
        val s = arrayOfNulls<String>(n)
        for (i in 0 until n) s[i] = `in`!!.nstr()
        Arrays.sort(s)
        val tot = (1L shl m) - 1
        var cur = tot / 2
        val req = (tot - n) / 2
        var c = "0"
        for (i in 0 until m - 1) c += "1"
        var pt = 0
        pt = 0
        while (pt < n) {
            if (c.compareTo(s[pt]!!) < 0) break
            --cur
            pt++
        }

        // out.println(cur + " " + req + " " + pt);
        if (cur > req) {
            --pt
            while (cur > req) {
                if (pt >= 0 && c.compareTo(s[pt]!!) == 0) {
                    --pt
                } else {
                    --cur
                }
                c = sub(c)
            }
        }
        if (cur == req) {
            --pt
            while (pt >= 0 && pt < n && c.compareTo(s[pt]!!) == 0) {
                c = sub(c)
                --pt
            }
        }
        while (cur < req) {
            c = ad(c)
            if (pt < n && c.compareTo(s[pt]!!) == 0) {
                ++pt
            } else {
                ++cur
            }
        }
        out!!.println(c)
    }

    fun ad(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '0') {
                    nxt[i] = '1'
                    carry = false
                } else nxt[i] = '0'
            }
        }
        return from(nxt)
    }

    fun sub(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '1') {
                    nxt[i] = '0'
                    carry = false
                } else nxt[i] = '1'
            }
        }
        return from(nxt)
    }

    fun from(c: CharArray): String {
        val sb = StringBuilder()
        for (i in c.indices) sb.append(c[i])
        return sb.toString()
    }

    @Throws(Exception::class)
    @JvmStatic
    fun main(_u_n_u_s_e_d_: Array<String>) {
        init_io("")
        var t = 1
        t = `in`!!.nint()
        for (tc in 0 until t) {
            solve(tc)
        }
    }

    fun minv(v: Long): Long {
        return mpow(v, mod - 2)
    }

    fun mpow(base: Long, exp: Long): Long {
        var base = base
        var exp = exp
        var res: Long = 1
        while (exp > 0) {
            if (exp and 1 == 1L) {
                res = res * base % mod
            }
            base = base * base % mod
            exp = exp shr 1
        }
        return res
    }

    fun gcd(x: Long, y: Long): Long {
        return if (x == 0L) y else gcd(y % x, x)
    }

    fun rsort(arr: LongArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    fun rsort(arr: IntArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    /* static void qsort(long[] arr) {
    Long[] oarr = new Long[arr.length];
    for (int i = 0; i < arr.length; i++) {
      oarr[i] = arr[i];
    }

    ArrayList<Long> alist = new ArrayList<Long>(Arrays.asList(oarr));
    Collections.sort(alist);

    for (int i = 0; i < arr.length; i++) {
      arr[i] = (long)alist.get(i);
    }
  } */
    fun reverse(arr: LongArray) {
        for (i in 0 until arr.size / 2) {
            val temp = arr[i]
            arr[i] = arr[arr.size - 1 - i]
            arr[arr.size - 1 - i] = temp
        }
    }

    fun atos(arr: LongArray?): String {
        var s = Arrays.toString(arr)
        s = s.substring(1, s.length - 1)
        return s.replace(",", "")
    }

    class IO(x: InputStream?) {
        var `in`: BufferedReader
        var tokens: StringTokenizer

        @Throws(Exception::class)
        fun nint(): Int {
            return nstr().toInt()
        }

        @Throws(Exception::class)
        fun nlong(): Long {
            return nstr().toLong()
        }

        @Throws(Exception::class)
        fun ndouble(): Double {
            return nstr().toDouble()
        }

        @Throws(Exception::class)
        fun nstr(): String {
            if (!tokens.hasMoreTokens()) tokens = StringTokenizer(`in`.readLine())
            return tokens.nextToken()
        }

        @Throws(Exception::class)
        fun nla(n: Int): LongArray {
            val arr = LongArray(n)
            for (i in 0 until n) {
                arr[i] = nlong()
            }
            return arr
        }

        init {
            `in` = BufferedReader(InputStreamReader(x))
            tokens = StringTokenizer(`in`.readLine())
        }
    }

    internal class Pair<A : Comparable<A>?, B : Comparable<B>?>(var f: A, var s: B) : Comparable<Pair<A, B>> {
        override fun compareTo(other: Pair<A, B>): Int {
            val v = f!!.compareTo(other.f)
            return if (v != 0) v else s!!.compareTo(other.s)
        }

        override fun toString(): String {
            return "(" + f.toString() + ", " + s.toString() + ")"
        }

    }
}

fun main(args: Array<String>) {
    Main.main(args);
}


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

object Main {
    var `in`: IO? = null
    var out: PrintWriter? = null

    @Throws(Exception::class)
    fun init_io(filename: String) {
        if (filename == "") {
            `in` = IO(System.`in`)
            out = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)), true)
        } else {
            `in` = IO(FileInputStream("$filename.in"))
            out = PrintWriter(BufferedWriter(FileWriter("$filename.out")), true)
        }
    }

    const val mod: Long = 998244353

    /*
fun main(args: Array<String>) {
    Main.main(args);
}
*/
    @Throws(Exception::class)
    fun solve(tc: Int) {
        val n = `in`!!.nint()
        val m = `in`!!.nint()
        val s = arrayOfNulls<String>(n)
        for (i in 0 until n) s[i] = `in`!!.nstr()
        Arrays.sort(s)
        val tot = (1L shl m) - 1
        var cur = tot / 2
        val req = (tot - n) / 2
        var c = "0"
        for (i in 0 until m - 1) c += "1"
        var pt: Int
        pt = 0
        while (pt < n) {
            if (c.compareTo(s[pt]!!) < 0) break
            --cur
            pt++
        }

        // out.println(cur + " " + req + " " + pt);
        if (cur > req) {
            --pt
            while (cur > req) {
                if (pt >= 0 && c.compareTo(s[pt]!!) == 0) {
                    --pt
                } else {
                    --cur
                    // if (cur == req) break;
                }
                c = sub(c)
            }
        }
        if (cur == req) {
            while (pt >= 0 && pt < n && c.compareTo(s[pt]!!) == 0) {
                c = sub(c)
                --pt
            }
            --pt
            while (pt >= 0 && pt < n && c.compareTo(s[pt]!!) == 0) {
                c = sub(c)
                --pt
            }
        }
        while (cur < req) {
            c = ad(c)
            if (pt < n && c.compareTo(s[pt]!!) == 0) {
                ++pt
            } else {
                ++cur
            }
        }
        out!!.println(c)
    }

    fun ad(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '0') {
                    nxt[i] = '1'
                    carry = false
                } else nxt[i] = '0'
            }
        }
        return from(nxt)
    }

    fun sub(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '1') {
                    nxt[i] = '0'
                    carry = false
                } else nxt[i] = '1'
            }
        }
        return from(nxt)
    }

    fun from(c: CharArray): String {
        val sb = StringBuilder()
        for (i in c.indices) sb.append(c[i])
        return sb.toString()
    }

    @Throws(Exception::class)
    @JvmStatic
    fun main(_u_n_u_s_e_d_: Array<String>) {
        init_io("")
        var t = 1
        t = `in`!!.nint()
        for (tc in 0 until t) {
            solve(tc)
        }
    }

    fun minv(v: Long): Long {
        return mpow(v, mod - 2)
    }

    fun mpow(base: Long, exp: Long): Long {
        var base = base
        var exp = exp
        var res: Long = 1
        while (exp > 0) {
            if (exp and 1 == 1L) {
                res = res * base % mod
            }
            base = base * base % mod
            exp = exp shr 1
        }
        return res
    }

    fun gcd(x: Long, y: Long): Long {
        return if (x == 0L) y else gcd(y % x, x)
    }

    fun rsort(arr: LongArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    fun rsort(arr: IntArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    /* static void qsort(long[] arr) {
    Long[] oarr = new Long[arr.length];
    for (int i = 0; i < arr.length; i++) {
      oarr[i] = arr[i];
    }

    ArrayList<Long> alist = new ArrayList<Long>(Arrays.asList(oarr));
    Collections.sort(alist);

    for (int i = 0; i < arr.length; i++) {
      arr[i] = (long)alist.get(i);
    }
  } */
    fun reverse(arr: LongArray) {
        for (i in 0 until arr.size / 2) {
            val temp = arr[i]
            arr[i] = arr[arr.size - 1 - i]
            arr[arr.size - 1 - i] = temp
        }
    }

    fun atos(arr: LongArray?): String {
        var s = Arrays.toString(arr)
        s = s.substring(1, s.length - 1)
        return s.replace(",", "")
    }

    class IO(x: InputStream?) {
        var `in`: BufferedReader
        var tokens: StringTokenizer

        @Throws(Exception::class)
        fun nint(): Int {
            return nstr().toInt()
        }

        @Throws(Exception::class)
        fun nlong(): Long {
            return nstr().toLong()
        }

        @Throws(Exception::class)
        fun ndouble(): Double {
            return nstr().toDouble()
        }

        @Throws(Exception::class)
        fun nstr(): String {
            if (!tokens.hasMoreTokens()) tokens = StringTokenizer(`in`.readLine())
            return tokens.nextToken()
        }

        @Throws(Exception::class)
        fun nla(n: Int): LongArray {
            val arr = LongArray(n)
            for (i in 0 until n) {
                arr[i] = nlong()
            }
            return arr
        }

        init {
            `in` = BufferedReader(InputStreamReader(x))
            tokens = StringTokenizer(`in`.readLine())
        }
    }

    internal class Pair<A : Comparable<A>?, B : Comparable<B>?>(var f: A, var s: B) : Comparable<Pair<A, B>> {
        override fun compareTo(other: Pair<A, B>): Int {
            val v = f!!.compareTo(other.f)
            return if (v != 0) v else s!!.compareTo(other.s)
        }

        override fun toString(): String {
            return "(" + f.toString() + ", " + s.toString() + ")"
        }

    }
}

fun main(args: Array<String>) {
    Main.main(args);
}


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

object Main {
    var `in`: IO? = null
    var out: PrintWriter? = null

    @Throws(Exception::class)
    fun init_io(filename: String) {
        if (filename == "") {
            `in` = IO(System.`in`)
            out = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)), true)
        } else {
            `in` = IO(FileInputStream("$filename.in"))
            out = PrintWriter(BufferedWriter(FileWriter("$filename.out")), true)
        }
    }

    const val mod: Long = 998244353

    /*
fun main(args: Array<String>) {
    Main.main(args);
}
*/
    @Throws(Exception::class)
    fun solve(tc: Int) {
        val n = `in`!!.nint()
        val m = `in`!!.nint()
        val s = arrayOfNulls<String>(n)
        for (i in 0 until n) s[i] = `in`!!.nstr()
        Arrays.sort(s)
        val tot = (1L shl m) - 1
        var cur = tot / 2
        val req = (tot - n) / 2
        var c = "0"
        for (i in 0 until m - 1) c += "1"
        var pt = 0
        pt = 0
        while (pt < n) {
            if (c.compareTo(s[pt]!!) < 0) break
            --cur
            pt++
        }

        // out.println(cur + " " + req + " " + pt);
        if (cur == req) {
            --pt
            while (pt >= 0 && pt < n && c.compareTo(s[pt]!!) == 0) {
                c = sub(c)
                --pt
            }
        }
        if (cur > req) {
            --pt
            while (cur > req) {
                if (pt >= 0 && c.compareTo(s[pt]!!) == 0) {
                    --pt
                } else {
                    --cur
                }
                c = sub(c)
            }
        }
        while (cur < req) {
            c = ad(c)
            if (pt < n && c.compareTo(s[pt]!!) == 0) {
                ++pt
            } else {
                ++cur
            }
        }
        out!!.println(c)
    }

    fun ad(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '0') {
                    nxt[i] = '1'
                    carry = false
                } else nxt[i] = '0'
            }
        }
        return from(nxt)
    }

    fun sub(s: String): String {
        val nxt = CharArray(s.length)
        var carry = true
        for (i in s.length - 1 downTo 0) {
            if (!carry) nxt[i] = s[i] else {
                if (s[i] == '1') {
                    nxt[i] = '0'
                    carry = false
                } else nxt[i] = '1'
            }
        }
        return from(nxt)
    }

    fun from(c: CharArray): String {
        val sb = StringBuilder()
        for (i in c.indices) sb.append(c[i])
        return sb.toString()
    }

    @Throws(Exception::class)
    @JvmStatic
    fun main(_u_n_u_s_e_d_: Array<String>) {
        init_io("")
        var t = 1
        t = `in`!!.nint()
        for (tc in 0 until t) {
            solve(tc)
        }
    }

    fun minv(v: Long): Long {
        return mpow(v, mod - 2)
    }

    fun mpow(base: Long, exp: Long): Long {
        var base = base
        var exp = exp
        var res: Long = 1
        while (exp > 0) {
            if (exp and 1 == 1L) {
                res = res * base % mod
            }
            base = base * base % mod
            exp = exp shr 1
        }
        return res
    }

    fun gcd(x: Long, y: Long): Long {
        return if (x == 0L) y else gcd(y % x, x)
    }

    fun rsort(arr: LongArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    fun rsort(arr: IntArray) {
        val r = Random()
        for (i in arr.indices) {
            val j = i + r.nextInt(arr.size - i)
            val t = arr[i]
            arr[i] = arr[j]
            arr[j] = t
        }
        Arrays.sort(arr)
    }

    /* static void qsort(long[] arr) {
    Long[] oarr = new Long[arr.length];
    for (int i = 0; i < arr.length; i++) {
      oarr[i] = arr[i];
    }

    ArrayList<Long> alist = new ArrayList<Long>(Arrays.asList(oarr));
    Collections.sort(alist);

    for (int i = 0; i < arr.length; i++) {
      arr[i] = (long)alist.get(i);
    }
  } */
    fun reverse(arr: LongArray) {
        for (i in 0 until arr.size / 2) {
            val temp = arr[i]
            arr[i] = arr[arr.size - 1 - i]
            arr[arr.size - 1 - i] = temp
        }
    }

    fun atos(arr: LongArray?): String {
        var s = Arrays.toString(arr)
        s = s.substring(1, s.length - 1)
        return s.replace(",", "")
    }

    class IO(x: InputStream?) {
        var `in`: BufferedReader
        var tokens: StringTokenizer

        @Throws(Exception::class)
        fun nint(): Int {
            return nstr().toInt()
        }

        @Throws(Exception::class)
        fun nlong(): Long {
            return nstr().toLong()
        }

        @Throws(Exception::class)
        fun ndouble(): Double {
            return nstr().toDouble()
        }

        @Throws(Exception::class)
        fun nstr(): String {
            if (!tokens.hasMoreTokens()) tokens = StringTokenizer(`in`.readLine())
            return tokens.nextToken()
        }

        @Throws(Exception::class)
        fun nla(n: Int): LongArray {
            val arr = LongArray(n)
            for (i in 0 until n) {
                arr[i] = nlong()
            }
            return arr
        }

        init {
            `in` = BufferedReader(InputStreamReader(x))
            tokens = StringTokenizer(`in`.readLine())
        }
    }

    internal class Pair<A : Comparable<A>?, B : Comparable<B>?>(var f: A, var s: B) : Comparable<Pair<A, B>> {
        override fun compareTo(other: Pair<A, B>): Int {
            val v = f!!.compareTo(other.f)
            return if (v != 0) v else s!!.compareTo(other.s)
        }

        override fun toString(): String {
            return "(" + f.toString() + ", " + s.toString() + ")"
        }

    }
}

fun main(args: Array<String>) {
    Main.main(args);
}


import java.util.Scanner

fun main(args: Array<String>) {
    val read = Scanner(System.`in`)

    val t = read.nextInt()

    for (testCase in 1..t) {
        val n = read.nextInt()
        val m = read.nextInt()
        var offset = 0
        val used = mutableSetOf<Int>()
        read.nextLine()
        var ans = (((1 shl m) - 1 - n) / 2).toInt()
        for (i in 1..n) {
            val binaryString = read.nextLine()
            val num = binaryString.toInt(2)
            if (num <= ans) {
                ++offset
            } else {
                used.add(num)
            }
        }
        val max = (1 shl m) - 1
        while (offset > 0 && ans < max) {
//            println("$offset ; $ans")
            ++ans
            if (!used.contains(ans)) {
                --offset
            }
        }
        println(ans.toString(2).padStart(m, '0'))
    }
}


import java.util.Scanner

fun main(args: Array<String>) {
    val read = Scanner(System.`in`)

    val t = read.nextInt()

    for (testCase in 1..t) {
        val n = read.nextInt()
        val m = read.nextInt()
        var offset = 0
        val used = mutableSetOf<Long>()
        read.nextLine()
        var ans: Long = (((1.toLong() shl m) - 1 - n) / 2).toLong()
        for (i in 1..n) {
            val binaryString = read.nextLine()
            val num = binaryString.toLong(2)
//            println(num)
            if (num <= ans) {
                ++offset
            } else {
                used.add(num)
            }
        }
        val max: Long = (1.toLong() shl m) - 1
        while (offset > 0 && ans < max) {
//            println("$offset ; $ans")
            ++ans
            if (!used.contains(ans)) {
                --offset
            }
        }
        println(ans.toString(2).padStart(m, '0'))
    }
}


/**
 * Description: Kotlin tips for dummies
 * Source: https://codeforces.com/blog/entry/71089, Kotlin Reference
 */

/// episode 1: https://codeforces.com/contest/1170
/// episode 2: https://codeforces.com/contest/1211
/// episode 3: https://codeforces.com/contest/1297

import java.io.*
import java.util.* // do NOT use Arrays.sort()

/// https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-field/
// @JvmField val INPUT = File("input.txt").inputStream()
@JvmField val INPUT = System.`in`
// @JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val OUTPUT = System.out
@JvmField val _reader = INPUT.bufferedReader()
@JvmField val _writer = PrintWriter(OUTPUT, false) // if not interactive, faster to call _writer.flush() at end
fun rLine(): String? = _reader.readLine()
fun rLn() = rLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String { // if no input left returns empty string
    while (_tokenizer.hasMoreTokens().not()) _tokenizer =
        StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun rInt() = read().toInt()
/// fun rDb() = read().toDouble()
fun rLong() = read().toLong()
fun rStrs(n: Int) = List(n,{read()})
fun rLns(n: Int) = List(n,{rLn()})
fun rInts(n: Int) = List(n,{rInt()})
/// fun rDbs(n: Int) = List(n,{rDb()})
fun rLongs(n: Int) = List(n,{rLong()})

/**val MOD = 1000000007
val INF = (1e18).toLong()
val SZ = 1 shl 17

fun YN(b: Boolean) : String { return if (b) "YES" else "NO"  }
fun add(a: Int, b: Int) = (a+b) % MOD // from tourist :o
fun sub(a: Int, b: Int) = (a-b+MOD) % MOD
fun mul(a: Int, b: Int) = ((a.toLong()*b)%MOD).toInt()*/
fun gcd(a: Int, b: Int) : Int = if (b == 0) a else gcd(b,a%b)

fun example() {
    println(String.format("%.8f", 5.25)) // print to 8 decimals
    val arr2D = Array<IntArray>(5,{IntArray(5,{5})})
    var (x,y) = arrayOf(3,2) // or rInts(2)
    when (x) { //  switch, can be used as expression
        0,1 -> println("x <= 1")
        2 -> println("x == 2") // Note the block
        else -> { println("x is neither 1 nor 2") }
    }
    x = y.also { y = x } // swap x and y
    println("${maxOf(x+2,y)}") // (x,y)=(4,3) -> 4
    val h = HashMap<String,Int>()
    val s = "ababa"
    for (i in 0..s.length-2) {
        val w = s.substring(i,i+2)
        val c = h.getOrElse(w,{0})
        h.put(w,c+1)
    }
    for ((a,b) in h) println("${a} ${b}") // key,value
    val pq = PriorityQueue<Pair<Long,Int>>({x,y ->
        x.first.compareTo(y.first)}) // or compareBy{it.first}
    val A = arrayListOf(Pair(1,3),Pair(3,2),Pair(2,3))
    val B = A.sortedWith(Comparator<Pair<Int,Int>>{x,y ->
        x.first.compareTo(y.first)}) // or sortBy{it.first}
    val list = arrayListOf('a','b','c','d','e')
    println(list.binarySearch('d')) // 3
    list.remove('d')
    val actualInsertPoint = -(list.binarySearch('d')+1) // 3
    list.add(actualInsertPoint, 'd') // [a,b,c,d,e]
    list.removeAt(1) // remove at index -> [a,c,d,e]
}

fun con(x: String): Long {
    var res = 0L
    for (c in x) {
        res = 2*res+(if (c == '1') 1 else 0)
    }
    return res
}

fun rcon(m: Int, _x: Long): String {
    var x = _x
    var res = ""
    for (i in 1..m) {
        res += ('0'+(x%2).toInt()).toChar()
        x /= 2
    }
//    println(x)
//    println(res.reversed())
    return res.reversed()
}

fun solve() {
    val (n,m) = rInts(2)
    val a = rStrs(n).map{x->con(x)}
    // println("WUT")
    // println(a)
    var z = maxOf((1L shl m-1)-105,0L)
    val des = ((1L shl m)-1-n)/2
    while (true) {
        var num = 0
        var bad = false
        for (x in a) {
            if (x < z) num += 1
            if (x == z) bad = true
        }
//        println("AH")
//        println(z)
//        println(num)
        if (bad || z-num != des) {
            z += 1
            continue
        }
        println(rcon(m,z))
        return
    }
}

fun main() {
    val t = rInt()
    for (i in 1..t) solve()
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    for (t in 0 until ni()) {
      out.println(solve2())
    }
  }

  fun solve2(): String {
    val N = ni()
    val M = ni()
    val S = Array(N){ns()}
    val size = 1L shl M
    val K = size - N
    val med = (K - 1) / 2
    val ans = IntArray(M)
    val flag = BooleanArray(N)
    var cntLowers = 0L
    for (i in 0 until M) {
      var cnt = 0
      for (j in 0 until N) {
        if (!flag[j]) {
          if (S[j][i] == '0') cnt++
        }
      }
      val add = (1L shl (M - i - 1)) - cnt
      if (cntLowers + add <= med) {
        ans[i] = 1
        cntLowers += add
        for (j in 0 until N) {
          if (!flag[j] && S[j][i] == '0') flag[j] = true
        }
      } else {
        ans[i] = 0
        for (j in 0 until N) {
          if (!flag[j] && S[j][i] == '1') flag[j] = true
        }
      }
    }
    return ans.joinToString("")
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


import java.util.*
fun readln() = readLine()!!
fun readint() = readln().toInt()
fun readlong() = readln().toLong()
fun readdouble() = readln().toDouble()
fun readstrings() = readln().split(" ")
fun readints() = readstrings().map { it.toInt() }
fun readlongs() = readstrings().map { it.toLong() }
fun readdoubles() = readstrings().map { it.toDouble() }

fun main() {
    var tt = readint()
    while (tt-- > 0) {
        var(n,m)=readints()
        var a=LongArray(n)
        for(i in 0..n-1){
            var s=readln()
            var l=0L
            for(j in 0..m-1){
                if(s[j]=='1'){
                    l+= 1L shl (m-1-j)
                }
            }
            a[i]=l
        }
        var z = ((1L shl m)-n.toLong()- 1L)/2L
        var lo=-1L
        var hi=1L shl m
        while(hi-lo>1L){
            var mid=(hi+lo)/2L
            var cnt=mid+1L
            for(i in 0..n-1){
                if(a[i]<=mid){
                    cnt--
                }
            }
            if(cnt<=z){
                lo=mid
            }else{
                hi=mid
            }
        }
        var ans=""
        lo=hi
        for(i in m-1 downTo 0){
            if((lo and (1L shl i)) != 0L){
                ans+='1'
            }else{
                ans+='0'
            }
        }
        println(ans)
    }
}

// kotlin sol.jar<in>out


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

val MOD = 924844033

fun main(args: Array<String>)
{
	Thread(null, Main(), "whatever", 1 shl 28).start()
}

class Main : Runnable {

	override fun run()
	{
		val inputStream = System.`in`
		val outputStream = System.out
		val `in` = InputReader(inputStream)
		val out = PrintWriter(outputStream)
		val solver = TaskD()
		var test = 1
		test = `in`.nextInt()
		for (t in 1..test)
		{
			solver.solve(t, `in`, out)
		}
		out.close()
	}

	internal class TaskD
	{
		fun solve(testNumber: Int, `in`: InputReader, out: PrintWriter) {
			val INF = 4000000000000000000L
			val dx = intArrayOf(-1, 1, 0, 0)
			val dy = intArrayOf(0, 0, -1, 1)

			var n = `in`.nextInt()
			var m = `in`.nextInt()
			var del = LongArray(n)
			for (i in 0..n-1)
			{
				var s = `in`.next()
				var x = 0L
				for (j in 0..m-1)
				{
					x = x*2
					if (s[j] == '1') x += 1
				}
				del[i] = x
			}

			var k = (1L shl m)-n
			var need = (k+1)/2

			var res = 0L
			var mask = 0L
			for (k in 0..m-1)
			{
				mask = mask or (1L shl (m-k-1))
				var remain = 1L shl (m-k-1)
				for (i in 0..n-1)
				{
					if ((del[i] and mask) == (res and mask)) remain -= 1
				}
				if (remain < need)
				{
					res = res or (1L shl (m-k-1))
					need -= remain
				}
			}

			while (true)
			{
				var found = 0
				for (i in 0..n-1)
					if (del[i] == res)
					{
						found = 1
						res --
						break
					}
				if (found == 0) break
			}

			for (k in 0..m-1)
				out.print((res shr (m-k-1))%2)
			out.println()
		}

	}

	internal class InputReader(stream: InputStream) {
		var reader: BufferedReader
		var tokenizer: StringTokenizer? = null

		init {
			reader = BufferedReader(InputStreamReader(stream), 32768)
			tokenizer = null
		}

		operator fun next(): String {
			while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
				try {
					tokenizer = StringTokenizer(reader.readLine())
				} catch (e: IOException) {
					throw RuntimeException(e)
				}

			}
			return tokenizer!!.nextToken()
		}

		fun nextInt(): Int {
			return Integer.parseInt(next())
		}

		fun nextLong(): Long {
		    return next().toLong()
		}

	}
}

fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a%b)

fun power(a: Long, b: Long, p: Long): Long
{
	if (b == 0L) return 1L
	var t = power(a, b/2, p)
	t = t*t%p
	if (b%2 == 1L) t = t*a%p
	return t
}


import kotlin.math.max
import kotlin.math.min

private fun isWhiteSpace(c: Char) = c in " \r\n\t"
private fun readString() = generateSequence { System.`in`.read().toChar() }
    .dropWhile { isWhiteSpace(it) }.takeWhile { !isWhiteSpace(it) }.joinToString("")
private fun readByte() = readString().toByte()
private fun readShort() = readString().toShort()
private fun readInt() = readString().toInt()
private fun readLong() = readString().toLong()
private fun readFloat() = readString().toFloat()
private fun readDouble() = readString().toDouble()

private fun readBytes(n: Int) = generateSequence { readByte() }.take(n)
private fun readShorts(n: Int) = generateSequence { readShort() }.take(n)
private fun readInts(n: Int) = generateSequence { readInt() }.take(n)
private fun readLongs(n: Int) = generateSequence { readLong() }.take(n)
private fun readFloats(n: Int) = generateSequence { readFloat() }.take(n)
private fun readDoubles(n: Int) = generateSequence { readDouble() }.take(n)

val maxn : Int = 100005;
val inf : Int = 1100002351;

var a : Array<Int> = Array(maxn, {0});

fun main()
{
    var t : Int = readInt();
    for(ii in 0 .. t - 1)
    {
        val n : Int = readInt();
        val m : Int = readInt();
        var a : Array <Long> = Array<Long>(n, {0});

        for(i in 0 .. n - 1)
        {
            var str : String = readString();
            var g : Long = 0;
            for(c in str)
            {
                g *= 2;
                if (c == '1') g++;
            }
            a[i] = g;
        }
        a.sort();
//        var k : Long = ((1.toLong() shl m) - n - 1) / 2;
        var sz : Long = (1.toLong() shl m);
        for(i in max(0, (sz - 1) / 2 - 101) .. min(sz - 1, (sz - 1) / 2 + 101))
        {
            var flag : Boolean = false;
            var r : Long = i;
            for(j in a)
            {
                if (j < i) --r;
                if (j == i)
                {
                    flag = true;
                    break;
                }
            }
            if (flag) continue;
            if (r == (sz - n - 1) / 2)
            {
                var ans : ArrayList<Int> = ArrayList(0);
                var j : Long = i;
                while(ans.size < m)
                {
                    ans.add((j % 2).toInt());
                    j /= 2
                }
                ans.reverse();
                for(d in ans)
                    print(d);
                println();
                break;
            }
        }
    }
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.math.BigInteger
import java.util.PriorityQueue
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val numCases = readInt()
    for(case in 1..numCases) {
        //print("Case #$case: ")
        val n = readInt()
        val m = readInt()

        val A = LongArray(n) { read().toLong(2) }
        A.sort()

        val k = (1L shl m) - n
        var i = (k-1) / 2

        for(a in A) {
            if(a <= i) i++
            else break
        }

        val ans = i.toString(2).padStart(m, '0')

        println(ans)
    }
}

/** IO */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar()
        else c
    }
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(true) {
            when(c) {
                '\n', Char.MIN_VALUE -> return@buildString
                else -> {
                    append(c)
                    c = readChar()
                }
            }
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() { iprintln(max(1, 2)) }

/** additional commons */
inline fun <T> Iterable<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
fun IntArray.sumLong() = fold(0L, Long::plus)


//region TEMPLATE
@file:Suppress("CanBeVal")

import com.sun.xml.internal.fastinfoset.util.StringArray
import java.io.*;
import java.io.BufferedReader
import java.lang.Integer.max
import java.lang.Integer.min
import java.util.*

fun main(args: Array<String>) {
    if (args.isNotEmpty() && args.first() == "file") {
        out = PrintWriter(FileWriter("output.txt"))
        reader = BufferedReader(FileReader("input.txt"))
        do {
            solve()
            out.println("\n")
            out.flush()
        } while (reader.readLine() != null)
    } else {
        reader = BufferedReader(InputStreamReader(System.`in`))
        out = PrintWriter(OutputStreamWriter(System.out))
        solve()
    }
    reader.close()
    out.close()
}

lateinit var out: PrintWriter
lateinit var reader: BufferedReader
var tokenizer: StringTokenizer? = null
fun read(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
        tokenizer = StringTokenizer(readLn())
    }
    return tokenizer!!.nextToken()
}

fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readLn() = reader.readLine()!!
fun readInts() = readLn().split(" ").map { it.toInt() }
fun readInts(sz: Int) = Array(sz) { readInt() }
fun readLongs() = readLn().split(" ").map { it.toLong() }
fun readLongs(sz: Int) = Array(sz) { readLong() }
fun print(b: Boolean) = out.print(b)
fun print(i: Int) = out.print(i)
fun print(d: Double) = out.print(d)
fun print(l: Long) = out.print(l)
fun print(s: String) = out.print(s)
fun print(message: Any?) = out.print(message)
fun print(a: Array<Int>) = a.forEach { print("$it ") }
fun <T> print(a: Array<out T>) = a.forEach { print("$it ") }
fun <T> print(a: Collection<T>) = a.forEach { print("$it ") }
fun println(b: Boolean) = out.println(b)
fun println(i: Int) = out.println(i)
fun println(d: Double) = out.println(d)
fun println(l: Long) = out.println(l)
fun println(s: String) = out.println(s)
fun println() = out.println()
fun println(message: Any?) = out.println(message)
fun <T> println(a: Array<out T>) {
    a.forEach { print("$it ") }
    println()
}

fun println(a: IntArray) {
    a.forEach { print("$it ") }
    println()
}

fun <T> println(a: Collection<T>) {
    a.forEach { print("$it ") }
    println()
}

const val M7 = 1000000007L
const val M9 = 1000000009L
const val MFFT = 998244353L
fun zero(sz: Int) = IntArray(sz)
fun zeroL(sz: Int) = LongArray(sz)
fun <T> init(vararg elements: T) = elements
fun VI(n: Int = 0, init: Int = 0) = MutableList(n) { init }
fun VVI(n: Int = 0, m: Int = 0, init: Int = 0) = MutableList(n) { VI(m, init) }
fun <T1 : Comparable<T1>, T2 : Comparable<T2>> pairCmp(): Comparator<Pair<T1, T2>> {
    return Comparator { a, b ->
        val res = a.first.compareTo(b.first)
        if (res == 0) a.second.compareTo(b.second) else res
    }
}
//endregion

fun solve() = repeat(readInt()) {
    var (n, m) = readInts(2)
    var a = Array(n) { read().toLong(2) }.sortedArray()
    var l = 0L
    var r = (1L shl m) - 1
    while (l < r) {
        var mid = r - (r - l) / 2
        var cntL = mid
        var cntR = r - mid
        for (v in a) {
            if (v <= mid) {
                cntL--
            } else {
                cntR--
            }
        }
        if (cntL <= cntR){
            l = mid
        } else {
            r = mid - 1
        }
    }
    for(i in 0 until n){
        if (l == a[i]){
            for(j in i downTo 0){
                if (l == a[j]){
                    l--
                } else {
                    break
                }
            }

            break
        }
    }
    var ans = CharArray(m){'0'}
    for(i in 0 until m){
        if (((l shr i) and 1L) == 1L){
            ans[m - i - 1] = '1'
        }
    }
    for(i in 0 until m){
        print(ans[i])
    }
    println()

}


//region TEMPLATE
@file:Suppress("CanBeVal")

import com.sun.xml.internal.fastinfoset.util.StringArray
import java.io.*;
import java.io.BufferedReader
import java.lang.Integer.max
import java.lang.Integer.min
import java.util.*

fun main(args: Array<String>) {
    if (args.isNotEmpty() && args.first() == "file") {
        out = PrintWriter(FileWriter("output.txt"))
        reader = BufferedReader(FileReader("input.txt"))
        do {
            solve()
            out.println("\n")
            out.flush()
        } while (reader.readLine() != null)
    } else {
        reader = BufferedReader(InputStreamReader(System.`in`))
        out = PrintWriter(OutputStreamWriter(System.out))
        solve()
    }
    reader.close()
    out.close()
}

lateinit var out: PrintWriter
lateinit var reader: BufferedReader
var tokenizer: StringTokenizer? = null
fun read(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
        tokenizer = StringTokenizer(readLn())
    }
    return tokenizer!!.nextToken()
}

fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readLn() = reader.readLine()!!
fun readInts() = readLn().split(" ").map { it.toInt() }
fun readInts(sz: Int) = Array(sz) { readInt() }
fun readLongs() = readLn().split(" ").map { it.toLong() }
fun readLongs(sz: Int) = Array(sz) { readLong() }
fun print(b: Boolean) = out.print(b)
fun print(i: Int) = out.print(i)
fun print(d: Double) = out.print(d)
fun print(l: Long) = out.print(l)
fun print(s: String) = out.print(s)
fun print(message: Any?) = out.print(message)
fun print(a: Array<Int>) = a.forEach { print("$it ") }
fun <T> print(a: Array<out T>) = a.forEach { print("$it ") }
fun <T> print(a: Collection<T>) = a.forEach { print("$it ") }
fun println(b: Boolean) = out.println(b)
fun println(i: Int) = out.println(i)
fun println(d: Double) = out.println(d)
fun println(l: Long) = out.println(l)
fun println(s: String) = out.println(s)
fun println() = out.println()
fun println(message: Any?) = out.println(message)
fun <T> println(a: Array<out T>) {
    a.forEach { print("$it ") }
    println()
}

fun println(a: IntArray) {
    a.forEach { print("$it ") }
    println()
}

fun <T> println(a: Collection<T>) {
    a.forEach { print("$it ") }
    println()
}

const val M7 = 1000000007L
const val M9 = 1000000009L
const val MFFT = 998244353L
fun zero(sz: Int) = IntArray(sz)
fun zeroL(sz: Int) = LongArray(sz)
fun <T> init(vararg elements: T) = elements
fun VI(n: Int = 0, init: Int = 0) = MutableList(n) { init }
fun VVI(n: Int = 0, m: Int = 0, init: Int = 0) = MutableList(n) { VI(m, init) }
fun <T1 : Comparable<T1>, T2 : Comparable<T2>> pairCmp(): Comparator<Pair<T1, T2>> {
    return Comparator { a, b ->
        val res = a.first.compareTo(b.first)
        if (res == 0) a.second.compareTo(b.second) else res
    }
}
//endregion

fun solve() = repeat(readInt()) {
    var (n, m) = readInts(2)
    var a = Array(n) { read().toLong(2) }.sortedArray()
    var l = 0L
    var r = (1L shl m) - 1
    while (l < r) {
        var mid = r - (r - l) / 2
        var cntL = mid
        var cntR = (1L shl m) - mid
        for (v in a) {
            if (v <= mid) {
                cntL--
            } else {
                cntR--
            }
        }
        if (cntL < cntR){
            l = mid
        } else {
            r = mid - 1
        }
    }
    for(i in 0 until n){
        if (l == a[i]){
            for(j in i downTo 0){
                if (l == a[j]){
                    l--
                } else {
                    break
                }
            }

            break
        }
    }
    var ans = CharArray(m){'0'}
    for(i in 0 until m){
        if (((l shr i) and 1L) == 1L){
            ans[m - i - 1] = '1'
        }
    }
    for(i in 0 until m){
        print(ans[i])
    }
    println()

}


import kotlin.reflect.jvm.internal.impl.protobuf.LazyStringArrayList

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
//Fast IO: https://github.com/finalchild/kotlin-fast-io/blob/master/src/solution.kt#L97

fun main(){
    var tc = readInt()
    while(tc-- > 0) {

        var (n, m) = readInts()
        var a = mutableListOf<Long>()
        for(i in 0..n-1){
            var s = readLn()
            var lol = 3000000000
            lol = 0
            for(j in 0..m-1){
                lol += lol
                if (s[j] == '1'){
                    lol++
                }
            }
            a.add(lol)
        }

        fun check(cand: Long): Long{
            var less = cand

            for(i in 0..n-1){
                if (a[i] < cand){
                    less--
                }
            }

            return less
        }

        fun je(cand: Long): Int{

            for(i in 0..n-1){
                if (a[i] == cand){
                    return 1
                }
            }

            return 0
        }

        var AAA = 3000000000
        AAA = 1
        for(i in 0..m-1) {
            AAA += AAA;
        }

        var all = AAA - n
        var needLess = (all - 1) / 2

        if (all <= 100){
            var curr = AAA
            for(i in 0..AAA-1){
                if (je(i) == 0 && check(i) == needLess){
                    curr = i
                    break
                }
            }

            var result = CharArray(m)

            var HUJ = 3000000000
            HUJ = 0
            for(iter in 1..m){
                if ((curr % 2) == HUJ){
                    result[m - iter] = '0'
                }else{
                    result[m - iter] = '1'
                }

                curr /= 2
            }

            for(i in 0..m-1){
                print(result[i])
            }
            println("")

            continue
        }

        var curr = AAA / 2 - 1
        var less = check(curr)

        while(less < needLess){
            curr++
            less = check(curr)
        }

        while(less > needLess){
            curr--;
            less = check(curr)
        }

        while(je(curr) == 1){
            curr--
        }

        if (curr < 0){
            curr++
            while(je(curr) == 1){
                curr++
            }
        }

        var result = CharArray(m)

        var HUJ = 3000000000
        HUJ = 0
        for(iter in 1..m){
            if ((curr % 2) == HUJ){
                result[m - iter] = '0'
            }else{
                result[m - iter] = '1'
            }

            curr /= 2
        }

        for(i in 0..m-1){
            print(result[i])
        }
        println("")
    }
}


import kotlin.reflect.jvm.internal.impl.protobuf.LazyStringArrayList

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
//Fast IO: https://github.com/finalchild/kotlin-fast-io/blob/master/src/solution.kt#L97

fun main(){
    var tc = readInt()
    while(tc-- > 0) {

        var (n, m) = readInts()
        var a = mutableListOf<Long>()
        for(i in 0..n-1){
            var s = readLn()
            var lol = 3000000000
            lol = 0
            for(j in 0..m-1){
                lol += lol
                if (s[j] == '1'){
                    lol++
                }
            }
            a.add(lol)
        }

        fun check(cand: Long): Long{
            var less = cand

            for(i in 0..n-1){
                if (a[i] < cand){
                    less--
                }
            }

            return less
        }

        fun je(cand: Long): Int{

            for(i in 0..n-1){
                if (a[i] == cand){
                    return 1
                }
            }

            return 0
        }

        var AAA = 3000000000
        AAA = 1
        for(i in 0..m-1) {
            AAA += AAA;
        }

        var all = AAA - n
        var needLess = (all - 1) / 2

        var curr = AAA / 2 - 1

        var magic = 257
        for(i in curr-magic .. curr+magic){
            if (check(i) == needLess && je(i) == 0){
                curr = i
                break
            }
        }

        var result = CharArray(m)

        var HUJ = 3000000000
        HUJ = 0
        for(iter in 1..m){
            if ((curr % 2) == HUJ){
                result[m - iter] = '0'
            }else{
                result[m - iter] = '1'
            }

            curr /= 2
        }

        for(i in 0..m-1){
            print(result[i])
        }
        println("")
    }
}


import kotlin.reflect.jvm.internal.impl.protobuf.LazyStringArrayList

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
//Fast IO: https://github.com/finalchild/kotlin-fast-io/blob/master/src/solution.kt#L97

fun main(){
    var tc = readInt()
    while(tc-- > 0) {

        var (n, m) = readInts()
        var a = mutableListOf<Long>()
        for(i in 0..n-1){
            var s = readLn()
            var lol = 3000000000
            lol = 0
            for(j in 0..m-1){
                lol += lol
                if (s[j] == '1'){
                    lol++
                }
            }
            a.add(lol)
        }

        fun check(cand: Long): Long{
            var less = cand

            for(i in 0..n-1){
                if (a[i] < cand){
                    less--
                }
            }

            return less
        }

        var AAA = 3000000000
        AAA = 1
        for(i in 0..m-1){
            AAA += AAA;
        }

        fun je(cand: Long): Int{

            for(i in 0..n-1){
                if (a[i] == cand){
                    return 1
                }
            }

            return 0
        }

        var curr = AAA / 2 - 1
        var less = check(curr)
        var all = AAA - n

        var needLess = (all - 1) / 2

        while(less < needLess){
            curr++
            less = check(curr)
        }

        while(less > needLess){
            curr--;
            less = check(curr)
        }

        while(je(curr) == 1){
            curr--
        }

        if (curr < 0){
            curr++
            while(je(curr) == 1){
                curr++
            }
        }

        var result = CharArray(m)

        var HUJ = 3000000000
        HUJ = 0
        for(iter in 1..m){
            if ((curr % 2) == HUJ){
                result[m - iter] = '0'
            }else{
                result[m - iter] = '1'
            }

            curr /= 2
        }

        for(i in 0..m-1){
            print(result[i])
        }
        println("")
    }
}


import kotlin.reflect.jvm.internal.impl.protobuf.LazyStringArrayList

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
//Fast IO: https://github.com/finalchild/kotlin-fast-io/blob/master/src/solution.kt#L97

fun main(){
    var tc = readInt()
    while(tc-- > 0) {
        var (n, m) = readInts()
        var a = mutableListOf<Long>()
        for(i in 0..n-1){
            var s = readLn()
            var lol = 3000000000
            lol = 0
            for(j in 0..m-1){

                lol += lol
                if (s[j] == '1'){
                    lol++
                }
            }
            a.add(lol)
        }

        fun check(cand: Long): Long{
            var less = cand

            for(i in 0..n-1){
                if (a[i] < cand){
                    less--
                }
            }

            return less
        }

        var AAA = 3000000000
        AAA = 1
        for(i in 0..m-1){
            AAA += AAA;
        }

        fun check2(cand: Long): Long{
            var less = AAA - cand - 1

            for(i in 0..n-1){
                if (a[i] > cand){
                    less--
                }
            }

            return less
        }

        fun je(cand: Long): Int{

            for(i in 0..n-1){
                if (a[i] == cand){
                    return 1
                }
            }

            return 0
        }

        var curr = AAA / 2 - 1
        var less = check(curr)
        var all = AAA - n

        var needLess = (all - 1) / 2
        var needMore = all / 2

        while(less < needLess){
            curr++
            less = check(curr)
        }

        var more = check2(curr)
        while(more > needMore){
            curr++;
            more = check2(curr)
        }

        while(je(curr) == 1){
            curr--
        }

        var result = CharArray(m)

        var HUJ = 3000000000
        HUJ = 0
        for(iter in 1..m){
            if ((curr % 2) == HUJ){
                result[m - iter] = '0'
            }else{
                result[m - iter] = '1'
            }

            curr /= 2
        }

        for(i in 0..m-1){
            print(result[i])
        }
        println("")
    }
}


fun printX(L : Long, m : Int){
    if(m == 0) return
    printX(L / 2, m - 1)
    print(L % 2)
}
fun main(){
    repeat(readLine()!!.toInt()){
        val (n, m) = readLine()!!.split(' ').map(String::toInt)
        val a = Array(n){
            var res = 0L
            for(c in readLine()!!)
                res = res * 2 + (c - '0')
            res
        }
        var L = 0L
        var R = (1L shl m) - 1
        var k = (R - n) / 2
        while(L < R){
            var M = (L + R + 1) / 2
            var X = M
            for(x in a) if(x < M) X -= 1
            if(X > k) R = M - 1
            else L = M
        }
        printX(L, m)
        println()
    }
}


import java.io.PrintWriter// {{{
import kotlin.math.*
import kotlin.collections.*// }}}

private fun run() {
    val (n, m) = readln()
    var a = ArrayList<Long>()
    for (i in 0..n - 1)
        a.add(readLine()!!.toLong(2))
    val M = 1L shl m
    val l = Math.max(0, M / 2 - n - 1)
    val r = Math.min(M - 1, M / 2 + n + 1)
    for (i in l..r) {
        var lower = i + 1
        var greater = M - i - 1
        var fail = false
        for (x in a)
            if (x == i)
                fail = true
            else if (x < i)
                lower--
            else
                greater--
        if (!fail)
            if (lower == greater || lower == greater + 1) {
                writeln(java.lang.Long.toBinaryString(i).padStart(m, '0'))
                return
            }
    }
    writeln("FAIL")
}

private fun PrintWriter.readSolveWrite() {
    val (t) = readln()
    for (q in 1..t) {
        run()
    }
}

private fun ok(x: Boolean) = if (x) 1 else 0// {{{

private fun writeln(vararg strings: Any) = println(strings.map{if (it is IntArray) it.joinToString(" ") else it}.joinToString(" "))

private fun readln() = getIntArray()

private fun getIntArray() = readLine()!!.splitToIntArray()

private fun bufferOut(block: PrintWriter.() -> Unit) = PrintWriter(System.out).use { block(it) }

data class Pt(val x: Int, val y: Int, val i: Int, var ans: Int)

fun main() = bufferOut { readSolveWrite() }

private fun String.splitToIntArray(): IntArray {
    val n = length
    if (n == 0) return IntArray(0) // EMPTY
    var res = IntArray(4)
    var m = 0
    var i = 0
    while (true) {
        var cur = 0
        var neg = false
        var c = get(i) // expecting number, IOOB if there is no number
        if (c == '-') {
            neg = true
            i++
            c = get(i) // expecting number, IOOB if there is no number
        }
        while (true) {
            val d = c.toInt() - '0'.toInt()
            require(d in 0..9) { "Unexpected character '$c' at $i" }
            require(cur >= Integer.MIN_VALUE / 10) { "Overflow at $i" }
            cur = cur * 10 - d
            require(cur <= 0) { "Overflow at $i" }
            i++
            if (i >= n) break
            c = get(i)
            if (c == ' ') break
        }
        if (m >= res.size) res = res.copyOf(res.size * 2)
        res[m++] = if (neg) cur else (-cur).also { require(it >= 0) { "Overflow at $i" } }
        if (i >= n) break
        i++
    }
    if (m < res.size) res = res.copyOf(m)
    return res
}// }}}


import java.math.BigInteger

fun readInt() = readLine()!!.toInt()
fun readInts() = readLine()!!.split(' ').map { it.toInt() }

fun main() {
    repeat(readInt()) {
        val (n, m) = readInts()

        var median = 2.toBigInteger().pow(m-1) - 1.toBigInteger()
        var balance = false
        val removed = mutableSetOf<BigInteger>()

        fun inc() {
            do {
                median++
            } while (removed.contains(median))
        }
        fun dec() {
            do {
                median--
            } while (removed.contains(median))
        }

        repeat(n) {
            val r = readLine()!!.toBigInteger(2)
            removed.add(r)
            when {
                r == median && !balance -> inc()
                r == median && balance -> dec()
                r < median && !balance -> inc()
                r < median && balance -> {}
                r > median && !balance -> {}
                else -> dec()
            }
            balance = !balance
        }

        val ans = median.toString(2)
        println("0".repeat(m-ans.length) + ans)
    }
}


import java.lang.Integer.max
import java.lang.Integer.min
import java.lang.StringBuilder
import java.util.*
import kotlin.collections.HashMap
import kotlin.math.sqrt

/*
    println(r.iterator().next().value)
    var r = TreeMap<Int, String>(Comparator<Int> { p0, p1 -> p1 - p0 })
    fun solve(a: Int): Int {

    var (n, m) = readLine()!!.split(' ').map{it.toInt()}
    var r = readLine()!!.split(' ').map { it.toInt() }.toMutableList()
    String.format("%.8g%n", d)
    var a = Array(n, {IntArray(n)})
    a = b.also { b = a }

 */

fun calc(a: MutableList<Long>, v: Long): Long {
    var R: Long = v + 1

    for (e in a) {
        if (e <= v) {
            R -= 1
        }
    }

    return R
}

tailrec fun bin(a: MutableList<Long>, l: Long, r: Long, t: Long): Long {
    if (r - l == 1.toLong()) {
        return r
    }

//    var m: Long = l + (r - l) / 2
    var m: Long = (l + r) / 2
    if (calc(a, m) < t) {
        return bin(a, m, r, t)
    } else {
        return bin(a, l, m, t)
    }
}

fun main() {
    val T = readLine()!!.toInt()
    for (tt in 1..T) {
        var (n, m) = readLine()!!.split(' ').map{it.toInt()}

        var a = MutableList<Long>(0){0}

        for (i in 0 until n) {
            var t = readLine()!!
            var p: Long = 0
            for (e in t) {
                p *= 2
                p += e - '0'
            }
            a.add(p)
        }

        var z: Long = 1.toLong().shl(m)
        var t: Long = (z - n) / 2 + (z - n) % 2
        var R = bin(a, -1, z, t)

//        println(R)
        var q = MutableList<Char>(0){' '}
        for (i in 0 until m) {
            q.add(('0'.toInt() + (R % 2)).toChar())
            R /= 2
        }
        q.reverse()
        println(String(q.toCharArray()))

    }
}


#include <bits/stdc++.h>
#define endl '\n'
#define lose            \
	{                   \
		printf("NO\n"); \
		return;         \
	}
#define win              \
	{                    \
		printf("YES\n"); \
		return;          \
	}
#define all(A) (A).begin(), (A).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define PER(I, A, B) for (int I = (A); I >= (B); --I)
#define DB(A) cout << (A) << endl
#define lson k * 2
#define rson k * 2 + 1
#define fi first
#define se second
#define PB push_back
#define Pair pair<int, int>
#define MP make_pair
#define LL long long
#define ull unsigned long long
#define int LL

using namespace std;
#define DB1(args...)            \
	do                          \
	{                           \
		cout << #args << " : "; \
		dbg(args);              \
	} while (0)
void dbg()
{
	std::cout << "  #\n";
}
template <typename T, typename... Args>
void dbg(T a, Args... args)
{
	std::cout << a << ' ';
	dbg(args...);
}
//var
const int maxn = 1e6 + 10;
const int MAX = 1e6;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
//head
int n, m;
int b[maxn];

int tr[maxn];
void add(int x, int t)
{
	for (int i = x; i <=n; i += (i & (-i)))
		(tr[i] += t) %= mod;
}
int get(int x)
{
	int ret = 0;
	for (int i = x; i; i -= (i & (-i)))
		(ret += tr[i]) %= mod;
	return ret;
}

void solve()
{
	cin >> n >> m;
    string s;
    getline(cin,s);
    bitset<63>a[n+1];
	FOR(i, 1, n)
	{
		getline(cin,s);
        a[i]=bitset<63>(s);
	}
    int middle=((1<<m)-n-1)/2;
    FOR(i,1,n) b[i]=a[i].to_ullong();
    sort(b+1,b+1+n);
    memset(tr,0,sizeof(tr));
    FOR(i,1,n)
    {
        add(i,1);
    }

    int l=0;
    int r=(1<<m)-1;
    int ans=-1;

    while (l<=r)
    {
        int mid=(l+r)/2;
        //DB1(mid);
        int pos=upper_bound(b+1,b+n+1,mid)-b-1;
        if (mid-get(pos)<middle)
        {
            l=mid+1;
        }
        else
        {
            ans=mid;
            r=mid-1;
        }

    }
    //DB1(ans);
    string ss=(bitset<3>(ans).to_string());
    FOR(i,ss.size()-m,ss.size()-1)
    {
        printf("%c",ss[i]);
    }
    printf("\n");

}
signed main()
{
	int TestCase = 1;
    cin>>TestCase;
	while (TestCase--)
	{
		solve();
	}
	char EndFile = getchar();
	EndFile = getchar();
	return 0;
}


private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

//val INF: Int = 1000000000

fun main() {
    var t = readInt()
    repeat(t) {
        var (n,m) = readInts()
        var a=Array(n){
            var res=0L
            for (c in readLn()){
                res=res*2+(c-'0')
            }
            res
        }
        a.sortByDescending { it }
        //a.forEach { println(it) }
        var l=0L
        var r=(1L shl m)-1
        val TrueRank=(l+r-n)/2
        var ans=TrueRank
        while (l<=r){
            var mid=(l+r)/2
            var value=mid
            for (x in a) if (x<mid) mid--
            if (mid>TrueRank){
                r=value-1
            }
            else if (mid<TrueRank){
                l=value+1
            }
            else{
                var flag=true
                for (x in a) if (x==value){
                    flag=false
                }
                if (flag){
                    ans=value
                    break
                }
                else{
                    l=value+1
                }
            }
        }

        fun printX(L:Long,m:Int){
            if (m==0) return
            printX(L/2,m-1)
            print(L%2)
        }

        printX(ans,m)
        println()
    }
}


import java.lang.StringBuilder
import java.util.*
import java.math.*
import kotlin.math.*

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readInts() = readLn().split(" ").map{ it.toInt() }
fun readLong() = readLn().toLong()
fun readLongs() = readLn().split(" ").map{ it.toLong() }

fun main() {
    var t = readInt()
    while (t-- > 0) {
        var nm = readInts()
        var n = nm[0]
        var m = nm[1]

        var rank = (1L.shl(m) - n - 1) / 2

        var s = arrayOfNulls<String>(n)
        for (i in 0 until n)
            s[i] = readLn()

        var v = Array<Long>(n) { it -> 0L }
        for (i in 0 until n) {
            var now = 0L
            for (j in 0 until m) {
                now = now.shl(1)
                if (s[i]!![j] == '1')
                    now++
            }
            v[i] = now
        }

        var l = 0L
        var r = 1L.shl(m)

        while (r >= l) {
            var mid = (l + r) / 2

            var count = mid
            for (i in 0 until n)
                if (v[i] < mid)
                    count--

            if (count <= rank) {
                l = mid + 1
            } else {
                r = mid - 1
            }
        }

        var ans = StringBuilder(m)
        for (i in 0 until m) {
            if (r.and(1L.shl(i)) > 0)
                ans.append('1')
            else
                ans.append('0')
        }

        ans = ans.reverse()
        println(ans)
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author masterbios
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        HBinaryMedian solver = new HBinaryMedian();
        solver.solve(1, in, out);
        out.close();
    }

    static class HBinaryMedian {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            try {
                int t = in.nextInt();
                while (t-- > 0) {
                    long n = in.nextLong(), m = in.nextLong();
                    long k = (1L << m) - n, nth = (k - 1L) >> 1L;
                    long low = 0L, high = (1L << m) - 1L;
                    long a[] = new long[(int) n];
                    for (int i = 0; i < n; i++) a[i] = Long.parseLong(in.next(), 2);
                    Arrays.sort(a);
                    while (low <= high) {
                        long mid = low + (high - low) / 2L;
                        long left = mid;
                        for (long x : a)
                            if (x <= mid) {
                                left--;
                            }
                        if (left < nth) low = mid + 1L;
                        else high = mid - 1L;
                    }
                    nth = high + 1L;
                    StringBuilder sb = new StringBuilder();
                    for (long i = 0L; i < m; i++) {
                        if ((nth & (1L << i)) != 0L) sb.append("1");
                        else sb.append("0");
                    }
                    sb.reverse();
                    out.println(sb.toString());
                }
            } catch (IOException e) {

            }
        }

    }

    static class FastReader {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public FastReader(InputStream in) {
            this.in = in;
        }

        public int scan() throws IOException {
            if (total < 0) throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int nextInt() throws IOException {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else {
                    throw new InputMismatchException();
                }
            }
            return neg * integer;
        }

        public long nextLong() throws IOException {
            long number = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            long neg = 1L;
            if (n == '-') {
                neg = -1L;
                n = scan();
            }
            long add = 0L;
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    number *= 10L;
                    add = (n - '0');
                    number += add;
                    n = scan();
                } else {
                    throw new InputMismatchException();
                }
            }
            return neg * number;
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            return false;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author masterbios
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        HBinaryMedian solver = new HBinaryMedian();
        solver.solve(1, in, out);
        out.close();
    }

    static class HBinaryMedian {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            try {
                int t = in.nextInt();
                while (t-- > 0) {
                    long n = in.nextLong(), m = in.nextLong();
                    long k = (1L << m) - n, nth = (k - 1) >> 1;
                    long low = 0, high = 1 << m;
                    long a[] = new long[(int) n];
                    for (int i = 0; i < n; i++) a[i] = Long.parseLong(in.next(), 2);
                    Arrays.sort(a);
                    while (low <= high) {
                        long mid = low + (high - low) / 2;
                        long left = mid;
                        for (long x : a)
                            if (x <= mid) {
                                left--;
                            }
                        if (left < nth) low = mid + 1;
                        else high = mid - 1;
                    }
                    nth = high + 1;
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < m; i++) {
                        if ((nth & (1L << i)) != 0) sb.append("1");
                        else sb.append("0");
                    }
                    sb.reverse();
                    out.println(sb.toString());
                }
            } catch (IOException e) {

            }
        }

    }

    static class FastReader {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public FastReader(InputStream in) {
            this.in = in;
        }

        public int scan() throws IOException {
            if (total < 0) throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int nextInt() throws IOException {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else {
                    throw new InputMismatchException();
                }
            }
            return neg * integer;
        }

        public long nextLong() throws IOException {
            long number = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            long neg = 1L;
            if (n == '-') {
                neg = -1L;
                n = scan();
            }
            long add = 0L;
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    number *= 10L;
                    add = (n - '0');
                    number += add;
                    n = scan();
                } else {
                    throw new InputMismatchException();
                }
            }
            return neg * number;
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            return false;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author masterbios
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        HBinaryMedian solver = new HBinaryMedian();
        solver.solve(1, in, out);
        out.close();
    }

    static class HBinaryMedian {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            try {
                int t = in.nextInt();
                while (t-- > 0) {
                    long n = in.nextLong(), m = in.nextLong();
                    long k = (1L << m) - n, nth = (k - 1) >> 1;
                    long low = 0, high = (1 << m) - 1;
                    long a[] = new long[(int) n];
                    for (int i = 0; i < n; i++) a[i] = Long.parseLong(in.next(), 2);
                    Arrays.sort(a);
                    nth++;
//                out.println("nth=" + nth + " k=" + k);
                    long minus = (1L << 60) + 2, mid = 0;
//                out.println("k=" + k + " nth=" + nth + " low=" + low + " high=" + high);
//                out.println("minus=" + minus + " mid=" + mid);
                    while (low <= high) {
                        mid = low + (high - low) / 2;
                        long get = lowerBound(a, mid);
                        long left = -1;
                        if (get == -1) left = nth + 1;
                        else left = (mid - a[(int) get]) + (a[(int) get] + 1) - (get + 1);
                        if (left < nth) {
                            low = mid + 1;
                        } else if (left == nth) {
                            if (a[(int) get] == mid) high = mid - 1;
                            else break;
                        } else {
                            high = mid - 1;
                        }
                    }
                    nth = mid;
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < m; i++) {
                        if ((nth & (1L << i)) != 0) sb.append("1");
                        else sb.append("0");
                    }
//                out.println(sb.toString());
                    sb.reverse();
                    out.println(sb.toString());
                }
            } catch (IOException e) {

            }
        }

        public long lowerBound(long a[], long find) {
            int low = 0, high = a.length - 1;
            while (low <= high) {
                int mid = low + (high - low) / 2;
                if (a[mid] <= find) {
                    low = mid + 1;
                } else {
                    high = mid - 1;
                }
            }
            return low - 1;
        }

    }

    static class FastReader {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public FastReader(InputStream in) {
            this.in = in;
        }

        public int scan() throws IOException {
            if (total < 0) throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int nextInt() throws IOException {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else {
                    throw new InputMismatchException();
                }
            }
            return neg * integer;
        }

        public long nextLong() throws IOException {
            long number = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            long neg = 1L;
            if (n == '-') {
                neg = -1L;
                n = scan();
            }
            long add = 0L;
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    number *= 10L;
                    add = (n - '0');
                    number += add;
                    n = scan();
                } else {
                    throw new InputMismatchException();
                }
            }
            return neg * number;
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            return false;
        }

    }
}