///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
const initializeGraph = (n) => { let G = []; for (let i = 0; i < n; i++) { G.push([]); } return G; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 09/05/21 night
const solve = (n, k, A) => {
    let a = initializeGraph(n + 1);
    for (let i = 0; i < n; i++) a[A[i]].push(i);
    // pr(a);
    let res = Array(n).fill(0);
    let b = [];
    for (let i = 1; i <= n; i++) {
        if (a[i].length < k) {
            for (const x of a[i]) b.push(x);
            continue;
        }
        for (let j = 0; j < k; j++) {
            res[a[i][j]] = j + 1;
        }
    }
    // pr(res)
    // pr(b)
    for (let i = 0; i + k <= b.length; i += k) {
        for (let j = 0; j < k; j++) {
            res[b[i + j]] = j + 1;
        }
    }
    pr(res.join(" "))
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i + 1]);
            i += 2;
        }
    });
};

main()

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL);

  // iter lines
  const cases = lines[0] - 0;

  for (let i = 1; i <= cases; i++) {
    const [n,k] = lines[2*i - 1].split(' ').map(x => parseInt(x));
    const arr = lines[2*i].split(' ').map(x => parseInt(x));
    // console.log(n,k,arr);
    // create a map for cycle
    const map = {};
    // pos[num] = [each pos]
    const pos = {};
    const rpos = {};
    const cnts = {};
    const ans = [];
    let target_count = 0;
    // count how many times each num appears, iter j
    for (let j = 0; j < arr.length; j++) {

      if (map[arr[j]]) {
        map[arr[j]]++;
      } else {
        map[arr[j]] = 1;
      }

      // pos
      if (pos[arr[j]]) {
        pos[arr[j]].push(j);
        // add target_count if arr[j] appeared less than k times
        if (map[arr[j]] <= k) {
          target_count++;
        }

      } else {
        pos[arr[j]] = [j];
        cnts[arr[j]] = 0;
        target_count+=1;
      }
    }

    // left target_count number should be multiple of k
    target_count -= (target_count % k);

    const poses = [];
    // flatten pos to poses
    for (let key in pos) {
      poses.push(...pos[key]);
    }

    // console.log(pos, poses, cnts)
    // console.log(target_count, map);

    // iter thru poses
    let color = 1;
    for (let j = 0; j < poses.length; j++) {
      // get now pos
      const now = poses[j];
      // get cnts of this num
      const cnt = cnts[arr[now]];
      // put ans cnt+1 if cnt < k
      if (cnt < k && target_count > 0) {
        ans[now] = color++;
        cnts[arr[now]]++;
        if(color > k) {
          color = 1;
        }
        target_count--;
      } else {
        ans[now] = 0;
      }

    }

    console.log(ans.join(' '));

  }

})

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let n;
let k;
let a;
let nxt;
let last;
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        k = nextInt();
        a = af(n);
        nxt = af(n).fill(INIT);
        last = af(n + 1).fill(INIT);
        const ans = af(n).fill(0);
        const uniq = new Set();
        for (let i = 0; i < n; i++) {
            a[i] = nextInt();
            uniq.add(a[i]);
            if (last[a[i]] != INIT) {
                nxt[i] = last[a[i]];
            }
            last[a[i]] = i;
        }
        let p = [];
        let i = 0;
        for (let v of uniq.values()) {
            for (let j = 0; j < k && last[v] != INIT; j++) {
                p.push(last[v]);
                last[v] = nxt[last[v]];
            }
        }
        let l = p.length - (p.length % k);
        check((l % k) == 0);
        for (let i = 0; i < l; i++) {
            ans[p[i]] = (i % k) + 1;
        }
        printf("%s\n", ans.join(' '));
        // printf("%j\n", nxt);
        // cnt.forEach((v: number, k: number) => { printf("%d=%d\n", v, k) });
        // console.log(cnt);
    }
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const [n, k] = rna();
		const a = rna();

		const mp = new Map();
		for (let i = 0; i < n; i++) {
			if (mp.has(a[i]))
				mp.get(a[i]).push(i);
			else
				mp.set(a[i], [i]);
		}

		const avl = [];
		for (const [elm, indxs] of mp) {
			for (let i = 0 ; i < indxs.length && i < k; i++) {
				avl.push(indxs[i]);
			}
		}

		const ans = Array(n).fill(0);
		for (let i = 0, clr = 0; i < Math.floor(avl.length/k)*k; i++) {
			clr = clr%k + 1;
			ans[avl[i]] = clr;
		}

		console.log(ans.join(' '));
	}
}

const readNum = () => +readline();
const readStr = () => readline();
const readNumArr = () => readline().split(' ').map(item => +item);

const n = readNum();

for(var i = 0; i < n; i++) {
  var ans = readNumArr();
  var m = ans[0];
  var k = ans[1];
  var vals = readNumArr();

  ans = []

  var uniq = new Map();
  var count = 0;

  for(var j = 0; j < m; j++) {
    var item = uniq.get(vals[j]);
    ans[j] = 0;

    if(!item) {
      uniq.set(vals[j], []);
      item = uniq.get(vals[j]);
    }

    item.push(j)
  }

  uniq.forEach(item => {
    count += item.length < k ? item.length : k;
  });

  count -= count % k;

  var lk = 0;

  uniq.forEach(item => {
    for(var j = 0; j < item.length && j < k; j++) {
      if(count) {
        lk++;
        ans[item[j]] = lk;
        if(lk === k) {
          lk = 0;
        }
        count--;
      }
    }
  });

  print(ans.join(' '));
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var [n, k] = lines[l++].trim().split(' ').map(Number)
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, k, arr))
    }
});

function solve(n, k, arr) {
    const map = {}
    for (let i = 0; i < arr.length; i++) {
        const ch = arr[i]
        map[ch] = (map[ch] || 0) + 1
    }

    let a = 0
    let b = 0
    const start = {}
    for (let x in map) {
        const count = map[x]
        if (count >= k) {
            a++
        } else {
            start[x] = b
            b += count
        }
    }
    const max = Math.floor(b / k) * k
// console.log(a, 'max', max)
// console.log(start)
    // let idx = 0
    const cur = {}
    return arr.map(x => {
        const count = map[x]
        let color = 0
        if (count >= k) {
            cur[x] = cur[x] || 1
            if (cur[x] <= k) {
                color = cur[x]++
            }
        } else {
            // if (idx < max) {
            const now = start[x] + (cur[x] || 0)
            // console.log(now, max)
            if (now < max) {
                color = now + 1
                if (color % k) color = color % k
                else color = k
                // console.log(now, color)

                cur[x] = (cur[x] || 0) + 1
            }
        }
        return color
    }).join(' ')
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var [n, k] = lines[l++].trim().split(' ').map(Number)
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, k, arr))
    }
});

function solve(n, k, arr) {
    const map = {}
    for (let i = 0; i < arr.length; i++) {
        const ch = arr[i]
        map[ch] = (map[ch] || 0) + 1
    }

    let a = 0
    let b = 0
    const start = {}
    for (let x in map) {
        const count = map[x]
        if (count >= k) {
            a++
        } else {
            start[x] = b
            b += count
        }
    }
    const max = Math.floor(b / k) * k
// console.log(a, 'max', max)
    let idx = 0
    const cur = {}
    return arr.map(x => {
        const count = map[x]
        let color = 0
        if (count >= k) {
            cur[x] = cur[x] || 1
            if (cur[x] <= k) {
                color = cur[x]++
            }
        } else {
            // if (idx < max) {
            if (idx < max && start[x] < max) {
                cur[x] = cur[x] || 1
                color = (start[x] + cur[x]++) % k
                color++
                // color = (idx++ % k) + 1
                idx++
            }
        }
        return color
    }).join(' ')
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var [n, k] = lines[l++].trim().split(' ').map(Number)
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, k, arr))
    }
});

function solve(n, k, arr) {
    const map = {}
    for (let i = 0; i < arr.length; i++) {
        const ch = arr[i]
        map[ch] = (map[ch] || 0) + 1
    }

    let a = 0
    let b = 0
    const start = {}
    for (let x in map) {
        const count = map[x]
        if (count >= k) {
            a++
        } else {
            start[x] = b
            b += count
        }
    }
    const max = Math.floor(b / k) * k
// console.log(a, 'max', max)
    let idx = 0
    const cur = {}
    return arr.map(x => {
        const count = map[x]
        let color = 0
        if (count >= k) {
            cur[x] = cur[x] || 1
            if (cur[x] <= k) {
                color = cur[x]++
            }
        } else {
            if (idx < max) {
                cur[x] = cur[x] || 1
                color = (start[x] + cur[x]++) % k
                color++
                // color = (idx++ % k) + 1
                idx++
            }
        }
        return color
    }).join(' ')
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var [n, k] = lines[l++].trim().split(' ').map(Number)
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, k, arr))
    }
});

function solve(n, k, arr) {
    const map = {}
    for (let i = 0; i < arr.length; i++) {
        const ch = arr[i]
        map[ch] = (map[ch] || 0) + 1
    }

    const p = []
    for (let x in map) {
        const count = map[x]
        p.push(count)
    }
    p.sort((a, b) => a - b)

    const pre = []
    p.forEach((x, i) => {
        pre[i] = i ? pre[i - 1] + x : x
    })
// console.log(p, pre)
    let max = -Infinity
    let ek
    let limit
    for (let i = 1; i <= k; i++) {
        const idx = binarySearch(0, p.length - 1, x => p[x] < i)
        const b = idx < 0 ? 0 : pre[idx]
        const a = p.length - 1 - idx
        const cur = (a + Math.floor(b / i)) * i
        // console.log(i, a, b, cur)
        if (cur > max) {
            max = cur
            ek = i
            limit = Math.floor(b / i) * i
        }
    }
    // console.log(max, ek, limit)
    k = ek
// console.log(a, 'max', max)
    let idx = 0
    const cur = {}
    return arr.map(x => {
        const count = map[x]
        let color = 0
        if (count >= k) {
            cur[x] = cur[x] || 1
            if (cur[x] <= k) {
                color = cur[x]++
            }
        } else {
            if (idx < limit) {
                color = (idx++ % k) + 1
            }
        }
        return color
    }).join(' ')
}
function binarySearch(l, r, fn) {
    while (l <= r) {
        const m = Math.floor((l + r) / 2)
        if (fn(m)) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return r
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var [n, k] = lines[l++].trim().split(' ').map(Number)
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, k, arr))
    }
});

function solve(n, k, arr) {
    const map = {}
    for (let i = 0; i < arr.length; i++) {
        const ch = arr[i]
        map[ch] = (map[ch] || 0) + 1
    }

    let a = 0
    let b = 0
    for (let x in map) {
        const count = map[x]
        if (count >= k) {
            a++
        } else {
            b += count
        }
    }
    const max = Math.floor(b / k) * k
// console.log(a, 'max', max)
    let idx = 0
    const cur = {}
    return arr.map(x => {
        const count = map[x]
        let color = 0
        if (count >= k) {
            cur[x] = cur[x] || 1
            if (cur[x] <= k) {
                color = cur[x]++
            }
        } else {
            if (idx < max) {
                color = (idx++ % k) + 1
            }
        }
        return color
    }).join(' ')
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var [n, k] = lines[l++].trim().split(' ').map(Number)
        var arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, k, arr))
    }
});

function solve(n, k, arr) {
    const map = {}
    for (let i = 0; i < arr.length; i++) {
        const ch = arr[i]
        map[ch] = (map[ch] || 0) + 1
    }

    let idx = 0
    const cur = {}
    return arr.map(x => {
        const count = map[x]
        let color = 0
        if (count >= k) {
            cur[x] = cur[x] || 1
            if (cur[x] <= k) {
                color = cur[x]++
            }
        } else {
            color = idx + 1
            idx = (idx + 1) % k
        }
        return color
    }).join(' ')
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL);

  // iter lines
  const cases = lines[0] - 0;

  for (let i = 1; i <= cases; i++) {
    const [n,k] = lines[2*i - 1].split(' ').map(x => parseInt(x));
    const arr = lines[2*i].split(' ').map(x => parseInt(x));
    // console.log(n,k,arr);
    // create a map for cycle
    const map = {};
    // pos[num] = [each pos]
    const pos = {};
    const rpos = {};
    const cnts = {};
    const ans = [];
    let target_count = 0;
    // count how many times each num appears, iter j
    for (let j = 0; j < arr.length; j++) {

      if (map[arr[j]]) {
        map[arr[j]]++;
      } else {
        map[arr[j]] = 1;
      }

      // pos
      if (pos[arr[j]]) {
        pos[arr[j]].push(j);
        // add target_count if arr[j] appeared less than k times
        if (map[arr[j]] <= k) {
          target_count++;
        }

      } else {
        pos[arr[j]] = [j];
        cnts[arr[j]] = 0;
        target_count+=1;
      }
    }

    // left target_count number should be multiple of k
    target_count -= (target_count % k);

    const poses = [];
    // flatten pos to poses
    for (let key in pos) {
      poses.push(...pos[key]);
    }

    // console.log(pos, poses, cnts)
    // console.log(target_count, map);

    // iter thru poses
    let color = 1;
    // for (let j = 0; j < poses.length; j++) {
    //   // get now pos
    //   const now = poses[j];
    //   // get cnts of this num
    //   const cnt = cnts[arr[now]];
    //   // put ans cnt+1 if cnt < k
    //   if (cnt < k && target_count > 0) {
    //     ans[now] = color++;
    //     cnts[arr[now]]++;
    //     if(color > k) {
    //       color = 1;
    //     }
    //     target_count--;
    //   } else {
    //     ans[now] = 0;
    //   }

    // }

    // iter through arr
    for (let j = 0; j < arr.length; j++) {
      // get cnts of this num
      const cnt = cnts[arr[j]];
      // put ans color if cnt < k
      if (cnt < k && target_count > 0) {
        ans[j] = color++;
        cnts[arr[j]]++;
        if(color > k) {
          color = 1;
        }
        target_count--;
      } else {
        ans[j] = 0;
      }
    }

    console.log(ans.join(' '));

  }

})

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL);

  // iter lines
  const cases = lines[0] - 0;

  for (let i = 1; i <= cases; i++) {
    const [n,k] = lines[2*i - 1].split(' ').map(x => parseInt(x));
    const arr = lines[2*i].split(' ').map(x => parseInt(x));
    // console.log(n,k,arr);
    // create a map for cycle
    const map = {};
    // pos[num] = [each pos]
    const pos = {};
    const rpos = {};
    const cnts = {};
    const ans = [];
    // count how many times each num appears, iter j
    for (let j = 0; j < arr.length; j++) {

      if (map[arr[j]]) {
        map[arr[j]]++;
      } else {
        map[arr[j]] = 1;
      }

      // pos
      if (pos[arr[j]]) {
        pos[arr[j]].push(j);
      } else {
        pos[arr[j]] = [j];
        cnts[arr[j]] = 0;
      }
    }

    const poses = [];
    // flatten pos to poses
    for (let key in pos) {
      poses.push(...pos[key]);
    }

    // console.log(pos, poses, cnts)

    // iter thru poses
    let color = 1;
    for (let j = 0; j < poses.length; j++) {
      // get now pos
      const now = poses[j];
      // get cnts of this num
      const cnt = cnts[arr[now]];
      // put ans cnt+1 if cnt < k
      if (cnt < k) {
        ans[now] = color++;
        cnts[arr[now]]++;
        if(color > k) {
          color = 1;
        }
      } else {
        ans[now] = 0;
      }

    }

    console.log(ans.join(' '));

  }

})

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL);

  // iter lines
  const cases = lines[0] - 0;

  for (let i = 1; i <= cases; i++) {
    const [n,k] = lines[2*i - 1].split(' ').map(x => parseInt(x));
    const arr = lines[2*i].split(' ').map(x => parseInt(x));
    // console.log(n,k,arr);
    // create a map for cycle
    const map = new Map();
    const ans = [];
    // count how many times each num appears
    for (let j = 0; j < arr.length; j++) {
      const num = arr[j] - 0;
      if (map.has(num)) {
        map.set(num, map.get(num) + 1);
      } else {
        map.set(num, 1);
      }
    }

    // iter through the map values, init keys to zero
    const used = {};
    for (let key of map.keys()) {
      used[key] = 0;
    }

    // start from color 1, cycle through ~k
    let color = 1;
    // iter throught nums
    for (let j = 0; j < arr.length; j++) {
      const num = arr[j] - 0;
      // if num is already used k times, skip it
      if (used[num] >= k) {
        // put 0 to ans
        ans.push(0);
        continue;
      }
      // count used
      used[num] = used[num] + 1;
      // put color to ans
      ans.push(color);
      // color++
      color++;
      // if color > k, reset color to 1
      if (color > k) {
        color = 1;
      }

    }

    console.log(ans);

  }

})

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL);

  // iter lines
  const cases = lines[0] - 0;

  for (let i = 1; i <= cases; i++) {
    const [n,k] = lines[2*i - 1].split(' ').map(x => parseInt(x));
    const arr = lines[2*i].split(' ').map(x => parseInt(x));
    // console.log(n,k,arr);
    // create a map for cycle
    const map = new Map();
    const ans = [];
    // for each num in arr
    for (let j = 0; j < arr.length; j++) {
      // if the num is not in map, add it
      if (!map.has(arr[j])) {
        map.set(arr[j], 1);
      }
      // else if the num is in map, increase the count by 1
      else {
        map.set(arr[j], map.get(arr[j]) + 1);
        // if the count is more than k, put 0 to ans
        if (map.get(arr[j]) > k) {
          ans.push(0);
          continue;
        }
      }
      // put the map num to ans
      ans.push(map.get(arr[j]));

    }

    console.log(ans.join(' '));

  }

})

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let n;
let k;
let a;
let nxt;
let last;
let cnt;
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        k = nextInt();
        a = af(n);
        nxt = af(n).fill(INIT);
        last = af(n + 1).fill(INIT);
        cnt = af(n + 1).fill(0);
        const ans = af(n).fill(0);
        const uniq = new Set();
        for (let i = 0; i < n; i++) {
            a[i] = nextInt();
            uniq.add(a[i]);
            cnt[a[i]]++;
            if (last[a[i]] != INIT) {
                nxt[i] = last[a[i]];
            }
            last[a[i]] = i;
        }
        let p = af(n);
        let i = 0;
        for (let v of uniq.values()) {
            for (let j = 0; j < k && last[v] != INIT; j++) {
                p[i++] = last[v];
                last[v] = nxt[last[v]];
            }
        }
        let l = p.length - (p.length % k);
        for (let i = 0; i < l; i++) {
            ans[p[i]] = (i % k) + 1;
        }
        printf("%s\n", ans.join(' '));
        // printf("%j\n", nxt);
        // cnt.forEach((v: number, k: number) => { printf("%d=%d\n", v, k) });
        // console.log(cnt);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let n;
let k;
let a;
let ans;
let nxt;
let last;
let cnt;
let uniq;
function answer(len) {
    const can = new Set(uniq.values());
    const rem = Array.from(cnt);
    const p = Array.from(last);
    ans.fill(0);
    for (let col = 1; col <= k; col++) {
        if (can.size < len) {
            return false;
        }
        let g = 0;
        for (let v of can.values()) {
            check(p[v] != INIT);
            check(rem[v] > 0);
            ans[p[v]] = col;
            p[v] = nxt[p[v]];
            rem[v]--;
            if (rem[v] == 0) {
                can.delete(v);
            }
            g++;
            if (g >= len) {
                break;
            }
        }
    }
    //  printf("answer %d ok\n", len);
    return true;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        k = nextInt();
        a = af(n);
        nxt = af(n).fill(INIT);
        last = af(n + 1).fill(INIT);
        cnt = af(n + 1).fill(0);
        ans = af(n).fill(0);
        uniq = new Set();
        for (let i = 0; i < n; i++) {
            a[i] = nextInt();
            uniq.add(a[i]);
            cnt[a[i]]++;
            if (last[a[i]] != INIT) {
                nxt[i] = last[a[i]];
            }
            last[a[i]] = i;
        }
        let lo = 0;
        let hi = n;
        let best = INIT;
        while (lo < hi) {
            let mid = lo + Math.trunc((hi - lo) / 2);
            // printf("mid %d\n", mid);
            if (answer(mid)) {
                best = mid;
                lo = mid + 1;
            }
            else {
                hi = mid;
            }
        }
        check(best != INIT);
        answer(best);
        printf("%s\n", ans.join(' '));
        // printf("%j\n", nxt);
        // cnt.forEach((v: number, k: number) => { printf("%d=%d\n", v, k) });
        // console.log(cnt);
    }
}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 07/23/21 morning
 * https://codeforces.com/contest/1551/problem/B2
 */
const solve = (n, k, a) => {
    // pr(n, k, a)
    let m = counter_value_in_indexA_in(a);
    let res = Array(n).fill(0);
    // pr(m)
    let red = 0;
    for (const [c, a] of m) {
        let occ = a.length;
        if (occ >= k) {
            red++;
            for (let i = 0, color = 1; i < k; i++, color++) {
                res[a[i]] = color;
            }
            m.delete(c);
        }
    }
    m = new Map([...m].sort((x, y) => y[1].length - x[1].length));
    // pr(m)
    // pr(res);
    let sum = 0;
    for (const [, a] of m) {
        sum += a.length;
    }
    let each = int(sum / k);
    let d = [];
    for (const [, aa] of m) {
       for(const i of aa) d.push(i);
    }
    // pr(res);
    for (let i = 0, color = 1; i < k; i++, color++) {
        if (d[i] < n) res[d[i]] = color;
    }
    pr(res)
    // let ca = Array.from(m.keys());
    // let n = ca.length;
    // let idx = 0;
    // for (; idx < n; ) {
    //     if (each == 0) break;
    //     let c = ca[idx];
    //     let a = m.get(c);
    //     let occ = a.length;
    //     if (occ >= k) {
    //         for (let i = 0, color = 1; i < k; i++, color++) {
    //             res[a[i]] = color;
    //             each--;
    //         }
    //         m.delete(c);
    //         idx++;
    //     } else {
    //         let rest = k - occ;
    //         for (let i = 0, color = 1; i < occ; i++, color++) {
    //             res[a[i]] = color;
    //             each--;
    //         }
    //         m.delete(c);
    //         idx++;
    //     }
    // }
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i + 1]);
            i += 2;
        }
    });
};

main()


var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

// Binary Indexed Tree

const SIZE = 2**18;
//const data = Array(SIZE + 1).fill(0);
let data = Array(SIZE);

function add (i, v) {
	let cnt = 0;
	++i;
	while (i <= SIZE) {
		if (!data[i]) data[i] = 0;
		data[i] += v;
		i += i&-i;
		if (i == 0)  break;
	}
}

function sum (i) {
	let res = 0;
	++i;
	while (i > 0) {
		if (!data[i]) data[i] = 0;
		res += data[i];
		i -= i&-i;
	}
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		//data = Array(SIZE);
		for (let i = 0; i <= SIZE; i++) data[i] = 0;

		const n = rn();
		const a = rna();

		for (let i = 0; i < n; i++) a[i] = [a[i], i];
		a.sort((x, y) => x[0] - y[0]);

		const b = [];
		for (let i = 0, cur = 0; i < n; i++) {
			b[a[i][1]] = i > 0 && (a[i][0] == a[i-1][0]) ? cur : ++cur;
		}

		let ans = 0;
		for (let i = 0; i < n; i++) {
			add(b[i], 1);
			ans += Math.min(sum(b[i] - 1), i + 1 - sum(b[i]));
		}

		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

// Binary Indexed Tree

const SIZE = 200005;
const data = Array(SIZE);

function add (i, v) {
	let cnt = 0;
	++i;
	while (i < SIZE) {
		data[i] += v;
		i += i&-i;
		if (i == 0)  break;
	}
}

function sum (i) {
	let res = 0;
	++i;
	while (i > 0) {
		res += data[i];
		i -= i&-i;
	}
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		for (let i = 0; i < SIZE; i++) data[i] = 0;

		const n = rn();
		const a = rna();

		for (let i = 0; i < n; i++) a[i] = [a[i], i];
		a.sort((x, y) => x[0] - y[0]);

		const b = [];
		for (let i = 0, cur = 0; i < n; i++) {
			b[a[i][1]] = i > 0 && (a[i][0] == a[i-1][0]) ? cur : ++cur;
		}

		let ans = 0;
		for (let i = 0; i < n; i++) {
			add(b[i], 1);
			ans += Math.min(sum(b[i] - 1), i + 1 - sum(b[i]));
		}

		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

// Binary Indexed Tree

const SIZE = 2**20;
const data = Array(SIZE);

function add (i, v) {
	let cnt = 0;
	++i;
	while (i <= SIZE) {
		if (!data[i]) data[i] = 0;
		data[i] += v;
		i += i&-i;
		if (i == 0)  break;
	}
}

function sum (i) {
	let res = 0;
	++i;
	while (i > 0) {
		if (!data[i]) data[i] = 0;
		res += data[i];
		i -= i&-i;
	}
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		for (let i = 0; i <= SIZE; i++) data[i] = 0;

		const n = rn();
		const a = rna();

		for (let i = 0; i < n; i++) a[i] = [a[i], i];
		a.sort((x, y) => x[0] - y[0]);

		const b = [];
		for (let i = 0, cur = 0; i < n; i++) {
			b[a[i][1]] = i > 0 && (a[i][0] == a[i-1][0]) ? cur : ++cur;
		}

		let ans = 0;
		for (let i = 0; i < n; i++) {
			add(b[i], 1);
			ans += Math.min(sum(b[i] - 1), i + 1 - sum(b[i]));
		}

		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

// Binary Indexed Tree

const SIZE = 2**19;
const data = Array(SIZE);

function add (i, v) {
	let cnt = 0;
	++i;
	while (i <= SIZE) {
		if (!data[i]) data[i] = 0;
		data[i] += v;
		i += i&-i;
		if (i == 0)  break;
	}
}

function sum (i) {
	let res = 0;
	++i;
	while (i > 0) {
		if (!data[i]) data[i] = 0;
		res += data[i];
		i -= i&-i;
	}
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		for (let i = 0; i <= SIZE; i++) data[i] = 0;

		const n = rn();
		const a = rna();

		for (let i = 0; i < n; i++) a[i] = [a[i], i];
		a.sort((x, y) => x[0] - y[0]);

		const b = [];
		for (let i = 0, cur = 0; i < n; i++) {
			b[a[i][1]] = i > 0 && (a[i][0] == a[i-1][0]) ? cur : ++cur;
		}

		let ans = 0;
		for (let i = 0; i < n; i++) {
			add(b[i], 1);
			ans += Math.min(sum(b[i] - 1), i + 1 - sum(b[i]));
		}

		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

// Binary Indexed Tree

const SIZE = 200005;
const data = Array(SIZE);

function add (i, v) {
	for (++i; i < SIZE; i += i&-i) data[i] += v;
}

function sum (i) {
	let res = 0;
	for (++i; i > 0; i -= i&-i) res += data[i];
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		for (let i = 0; i < SIZE; i++) data[i] = 0;

		const n = rn();
		const a = rna();

		for (let i = 0; i < n; i++) a[i] = [a[i], i];
		a.sort((x, y) => x[0] - y[0]);

		const b = [];
		for (let i = 0, cur = 0; i < n; i++) {
			b[a[i][1]] = i > 0 && (a[i][0] == a[i-1][0]) ? cur : ++cur;
		}

		let ans = 0;
		for (let i = 0; i < n; i++) {
			add(b[i], 1);
			ans += Math.min(sum(b[i] - 1), i + 1 - sum(b[i]));
		}

		console.log(ans);
	}
}


// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

function main(input) {
    let output = nameLookUp(input);
    //process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {

    let inputs = str.trim().split('\n');
    let t = +inputs[0].trim();
    for (let index = 1; index <= t; index++) {
        const element = inputs[index].trim();
        if (element.length > 2) {
            let sliceElement = element.slice(1, element.length - 1);
            let newElem = element[0];
            for (let index2 = 0; index2 < sliceElement.length; index2 += 2) {
                const elem = sliceElement[index2];
                newElem += elem;
            }
            newElem += element[element.length - 1];
            console.log(newElem);
        }
        else {
            console.log(element);
        }
    }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    let t = parseInt(readLine());
    while(t--) {
        let ans = "";
        let str = readLine();
        ans += str[0];
        ans += str[1];
        for(let i = 2; i < str.length; i++) {
            if (i%2 !== 0) {
                ans += str[i];
            }
        }
        console.log(ans);
    }
}

process.stdin.setEncoding('utf8');

function solve(input) {
    let data = [];

    for (let i = 0; i < input.length - 1; i += 2) {
        data.push(input[i]);
    }

    data.push(input[input.length - 1]);

    return data;
}

let input = '';

process.stdin.on('data', chunk => {
    if (chunk.trim() == 'end') process.stdin.emit('end');
    else input += chunk;
});

process.stdin.on('end', () => {
    input = input.trim().split('\n').slice(1);

    for (let i = 0; i < input.length; i++) {
        console.log( solve(input[i].trim()).join(''));
    }

    process.exit(0);
});

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStd) => {
  inputString += inputStd;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let str = readLine();
    console.log(solve(str));
  }

  function solve(str) {
    let output = str[0];
    if (str.length === 2) return str;
    for (let i = 1; i < str.length - 1; i += 2) {
      output += str[i];
    }
    output += str[str.length - 1];
    return output;
  }
}

//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var t = nextInt();
	var output = new Array(t);
	for(var i = 0; i < t; i++){
		var s = next();
		var n = s[0];
		for(var j = 1; j < s.length - 1; j = j + 2){
			n += s[j];
		}
		n += s[s.length - 1];
		output[i] = n;
	}
	myout(myconv(output,9));
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
    data = data.split('\n');
    const testCases = data[0] * 1;
    let i = 1;
    while (i <= testCases) {
        let k = data[i];
        const len = k.length;
        if (len === 2) {
            console.log(k);
            i += 1;
            continue;
        }
        let str = '';
        for (let i = 0; i <= len - 2; i += 2) str += k[i];
        str += k[len - 2];
        console.log(str);
        i += 1;
    }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let input = '';
process.stdin.on('data', (line) => {
    input += line;
});

process.stdin.on('end', () => {
    const lines = input.split('\n');
    let tests = parseInt(lines.shift(), 10);
    while(tests--) {
        const b = lines.shift();
        const a = b
            .split('')
            .filter((_, index) => {
                return index === 0 ||
                    index === b.length - 1 ||
                    index % 2
                }
            ).join('');
        console.log(a);
    }
});

const process = require('process')
let input = ''
process.stdin.on('data', data => input += data)
process.stdin.on('end', () => main(input))

function main(input) {
    let lines = input.trim().split('\n')
    lines.shift()
    for(let line of lines) {
        console.log(solution(line))
    }
}

function solution(line) {
    let ans = line[0]
    for(let i = 1; i < line.length - 1; i += 2) {
        ans += line[i]
    }
    ans += line[line.length - 1]
    return ans
}

function solve(s) {
  const result = [];
  result.push(s[0]);
  for (let i = 2; i < s.length; i = i + 2) {
    result.push(s[i]);
  }
  if ((s.length % 2) === 0) {
    result.push(s[s.length - 1]);
  }
  return result.join('');
}

function main(lines) {
  lines.shift();
  for (const line of lines) {
    let t = line.trim();
    if (line.length > 0) {
      const result = solve(t);
      console.log(result);
    }
  }
}

async function processLinesFromStream(rs, pf) {
  const content = [];
  rs.setEncoding("utf-8");
  for await (let chunk of rs) {
    content.push(chunk);
  }
  const lines = content.join('').split(/\n/);
  const result = pf(lines);
  return result;
}

processLinesFromStream(process.stdin, main);

function solve(s) {
  const result = [];
  result.push(s[0]);
  for (let i = 2; i < s.length; i = i + 2) {
    result.push(s[i]);
  }
  if ((s.length % 2) === 0) {
    result.push(s[s.length - 1]);
  }
  return result.join('');
}

function main(lines) {
  lines.shift();
  for (const line of lines) {
    const result = solve(line);
    console.log(result);
  }
}

function trim_line(s) {
  return s.trim();
}

function has_content(s) {
  return (s.length > 0);
}

async function processLinesFromStream(rs, pf) {
  const chunks = [];
  const encoding = 'utf-8';
  rs.setEncoding(encoding);
  for await (let chunk of rs) {
    chunks.push(chunk);
  }
  const empty = '';
  const newline = /\n/;
  const lines = chunks.join(empty)
                      .split(newline)
                      .map(trim_line)
                      .filter(has_content);
  const result = pf(lines);
  return result;
}

processLinesFromStream(process.stdin, main);

process.stdin.resume();
process.stdin.setEncoding('utf8');

let inputData = '';
let currentLine = 0;

function input() {
  return inputData[currentLine++];
}

process.stdin.on('data', _ => inputData += _);

process.stdin.on('end', () => {
  inputData = inputData.split(/\s+/);
  let noOfTestcases = input();
  let outputString = '';
  while (noOfTestcases--) {
    let str = input();

    outputString += originalWord(str) + '\n';
  }
  process.stdout.write(outputString);
  // console.log(inputData);

});

function originalWord(str) {
  if (str.length <= 2) return str;
  let newStr = str[0];
  for (let i = 1; i < str.length - 1; i = i + 2) {
    let char = str[i];
    newStr += char;

  }
  newStr += str[str.length - 1]
  return newStr;
}

var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

var input  = []
rl.on('line', function(line){
    input.push(line);
})

rl.on("close", ContestResponse);

function ContestResponse(){
    let index = 0;
    let nbCases= +input[index++]
    for (let i = 0; i < nbCases; i++){
      let str = input[index++]
      let ret = str[0];
      for (let i = 0; i < str.length - 1; i = i + 2){
        ret += str[i + 1]
      }
      console.log(ret);
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
4
abbaac
ac
bccddaaf
zzzzzzzzzz
**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function main() {
    let range = parseInt(readline());

    for(let r = 0;r<range;r++) {
        solve();
    }
}

function solve() {
    let a = readline().split("");
    let n = a.length;

    let string = a[0];
    for(let i=1;i<n-1;i=i+2) {
        if(a[i] === a[i+1]) {
            string+= a[i];
        }else {
            string = a[i] + a[i+1];
        }
    }

    string += a[n-1];
    console.log(string);
}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var str = readline();
  var res = "";
  for (var i = 0; i < str.length; i++) {
    if (i == 0) {
      res += str[i];
      continue;
    }
    if (str[i] == str[i + 1]) {
      res += str[i];
      i++;
    } else res += str[i];
  }
  print(res);
}

var lines = readline();

while(lines--){
    var strA = '';
    var str = Array.from(readline());
    for (var i = 1; i < str.length; i+=2) {
        strA += str[i];
    }
    print(str[0]+strA);
}

"use strict";

//readline().split(' ').map(Number);

function sec(){
    var stri = readline();
    write(stri[0]);
    for (var i=1; i< (stri.length)-1; i+= 2){
        write(stri[i]);
    }
    print(stri[stri.length -1]);
}

function main(){
    var t = readline();
    while(t--){
        sec();
    }
}

main();

function solve() {
   var T = Number(read());
   for (var t = 0; t < T; ++t) {
      var b = read();
      var n2 = Math.round(b.length / 2);
      var a = b[0];
      for (var i = 0; i < n2 - 1; ++i) {
         a = a + b[i * 2 + 1];
      }
      a = a + b[b.length - 1];
      write(a);
   }
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         solve();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

      RL.on('line', (line) => {
         MEMORY.push(line);
      });

      RL.on('close', solve);
   }
} else {
   solve();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

function solve(str) {
    var res = str.substr(0,2);
    for (var i=3; i<str.length; i+=2)
        res += str[i];
    return res;
}
var t = Number(readline());
while (t--) {
    var str = readline();
    print(solve(str));
}

process.stdin.setEncoding('utf8');

process.stdin.on('readable', () => {
    let input = process.stdin.read();
    input = input.trim();
    input = input.split('\n').slice(1);

    main(input);
});

function main(input) {
    for (let i = 0; i < input.length; i++) {
        console.log(solve(input[i]).join(''));
    }
    process.exit(0);
}

function solve(input) {
    let data = [];

    for (let i = 0; i < input.length - 1; i += 2) {
        data.push(input[i]);
    }

    data.push(input[input.length - 1]);

    return data;
}


var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const seq = (s, e) => Array.from(Array(e - s + 1), (_, i) => s + i);

function main () {
	let T = rn();
	while (T--) {
		let [n, k] = rna();

		const x = 2 * k - n - 1;
		const ans = [...seq(1, x), ...seq(x + 1, k).reverse()];

		console.log(ans.join(' '));
	}
}

/*
 * File Created: Thursday, 14th January 2021 3:54:21 pm
 * Author: Lukas Rimkus
 */

'use-strict'

process.stdin.resume();
process.stdin.setEncoding('utf8');

let data = '';
let currentLine = 0;

process.stdin.on('data', chunk => {
data += chunk;
});

process.stdin.on('end', () =>{
    data = data.replace(/\s*$/, '')
    .split('\n')
    .map(str => str.replace(/\s*$/, ''));

    let testCases = parseInt(readLine(), 10);

    while(testCases--) {

        const [n, k] = readLine().split(' ').map(Number);

        const res = c(n,k);

        console.log(res.join(" "));
    }
});

function get_ints() {
    return data.shift().split(' ').map(Number);
}

function readLine() {
        return data[currentLine++];
}

function a(n, d, arr){

    arr.sort((a,b) => a - b);
    // console.log(arr)
    for(let i = 0; i < n ; i++){
        if(arr[i] <= d) continue;
        if(arr[i] > d){
            if(arr[0] + arr[1] <= d && i !== 0 && i !== 1 ){
                continue;
            }
            if(i === 0){
                if(arr[1] + arr[2] <= d) continue;
            }
            if(i === 1){
                if(arr[0] + arr[2] <= d) continue;
            }
        }
        return 'NO'
    }
    return 'YES'
}

function gcd(a,b){
    if(b === 0) return a;
    else{
        return gcd(b, a % b)
    }
}

function lcm(a,b){
    return (a * b) / gcd(a,b)
}

function mul(s, k) {
    let res = '';
    while(k--) res += s;
    return res;
}

function b(s,t){
    const n = s.length;
    const m = t.length;
    const g = gcd(n,m);
    // console.log('gcd(n,m) = ',g,'mul(s,m/g) = ', mul(s, m/ g), 'mul(t,n/g) = ', mul(t, n / g), 'm/g = ', m/g, 'n/g = ', n/g)
    if(mul(s,m /g) === mul(t, n / g)){
        return mul(s, m / g);
    } else {
        return -1;
    }
}

function c(n ,k){
    let ans = [];
    for(let i = 1; i < (k - (n - k)); i++){
        ans.push(i);
    }
    for(let i = k ; i >= (k - (n - k)); i--){
        ans.push(i);
    }
    return ans
}

module.exports = c;


const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(arr) ? 'YES' : 'NO'
    }
    console.log(output.join('\n'))
// })()
})

function solve(arr) {
    arr.sort((p, q) => p - q)
    return arr[0] + arr[1] === arr[2]
        || (arr[0] === arr[1] && !(arr[2] & 1))
        || (arr[1] === arr[2] && !(arr[0] & 1))
}

var t = +readline()
for(var index = 1; index<=t; index++){
    var test = readline().split(' ')
    var a = +test[0]
    var b = +test[1]
    var c = +test[2]
    print(taskContext1(a,b,c))

}

function taskContext1(a,b,c) {

       if ((b == c && a % 2 == 0) || (a == c && b % 2 == 0) || (b == a && c % 2 == 0)){
    return 'Yes'
  }
  else if (a == b + c || b == c + a || c == a + b){
    return 'Yes'
  }

  return 'No'

}

 var t = parseInt(readline());

  function check(val) {
    return val % 2 === 0
  }

  function solve() {
    var input = readline()
      .split(" ")
      .map((data) => +data).sort((a, b) => {
        if (a > b) {
          return 1;
        } else if (a < b) {
          return -1;
        } else {
          return 0;
        }
      });
    var val1 = input[0]
    var val2 = input[1]
    var val3 = input[2]

    if (val1 === val2) {
      if (!check(val3)) {
        return "NO"
      } else {
        return "YES"
      }
    } else if (val2 === val3) {
      if (!check(val1)) {
        return "NO"
      } else {
        return "YES"
      }
    } else if (val3 === val1) {
      if (!check(val2)) {
        return "NO"
      } else {
        return "YES"
      }
    }

    var val = val1 + val2
    if (val === val3) {
      return "YES"
    }
    return "NO"
  }

  while (t--) {
    print(solve())
  }

t = readline()
while (t--) {
    input = readline().split(" ").map(Number).sort(function (a, b) { return a - b });
    if (input[0] === input[1] || input[1] === input[2] || input[0] === input[2]) {
        if (input[0] === input[1]) {
            if (input[2] % 2 === 0) {
                print("YES")
            } else {
                print("NO")
            }
        } else if (input[1] === input[2]) {
            if (input[0] % 2 === 0) {
                print("YES")
            } else {
                print("NO")
            }
        } else if (input[0] === input[2]) {
            if (input[1] % 2 === 0) {
                print("YES")
            } else {
                print("NO")
            }
        }
    } else {
        if (input[2] === input[0] + input[1]) {
            print("YES")
        } else {
            print("NO")
        }
    }
}

const numTestCases = parseInt(readline());

for (var i = 0; i < numTestCases; i++) {
    var inputNums = readline().split(' ');
    var l1 = parseInt(inputNums[0]);
    var l2 = parseInt(inputNums[1]);
    var l3 = parseInt(inputNums[2]);
    if (l1 === l2 + l3 || l2 === l1 + l3 || l3 === l2 + l1) {
        print ("Yes");
        continue;
    }

    if (l1 % 2 === 0 && l2 === l3 || (l2 % 2 === 0 && l1 === l3) || (l3 % 2 === 0 && l1 === l2)) {
        print("Yes");
    } else {
        print("No");
    }
}

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var test = readLine();
    while(test--)
    {
        var arr = readLine().split(" ").map((x) => {return parseInt(x)});
        arr.sort();
        var a = arr[0];
        var b = arr[1];
        var c = arr[2];
        var sum = a+b+c;
        if (a+b == c || b+c==a || a+c==b){
        console.log("YES");
        }
        else if (a == b && c % 2 == 0){
            console.log("YES");
        }
        else if (b == c && a % 2 == 0){
            console.log("YES");
        }
        else if (a == c && b % 2 == 0){
            console.log("YES");
        }
        else{
            console.log("NO");
        }

    }
    return 0;
}

const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim().split('\n');
let currentline = 0;
function readline(){
            return input[currentline++];
}
var T = readline();
for(var q=1;q<=T;q++) {
        let a = readline().split(" ").map(f => parseInt(f));
        console.log(solve(a))
        function solve(x) {
            if(x[0] == x[1]+x[2] || x[1] == x[0]+x[2] || x[2] == x[0]+x[1]) {
                return 'YES';
            }
            var x1 = x[1]==x[2]
            var x2 = x[0]==x[2]
            var x3 = x[1]==x[0]
            if(x1 && x[0]%2==0) return 'YES';
            if(x2 && x[1]%2==0) return 'YES';
            if(x3 && x[2]%2==0) return 'YES';
            return 'NO';
        }

}

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => {
        let next;
        do {
            next = (await getLineGen.next());
        } while (!next.done && next.value === '');
        return next.value;
    };
})();

let solve = async () => {
    const tsc = parseInt(await getLine());
    for(let nsc = 0; nsc < tsc; nsc++) {
        const l = (await getLine()).split(' ').map(s => parseInt(s));
        l.sort((a,b) => (a - b));
        if (l[1] === l[2]) {
            if (l[0] % 2 === 0)
                console.log('YES');
            else
                console.log('NO');
        }
        else {
           if (l[0] + l[1] === l[2] || (l[0] === l[1] && l[2] % 2 === 0))  {
               console.log('YES');
           } else
               console.log('NO');
        }
    }
}

solve();

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var n = lines[i].split(' ').map(Number);
        var a = n[0], b = n[1], c = n[2];
        if(a == b){
            if(c % 2 === 0){
                console.log('YES');
                continue;
            }
        }if(b == c){
            if(a % 2 === 0){
                console.log('YES');
                continue;
            }
        }if(c == a){
            if(b % 2 === 0){
                console.log('YES');
                continue;
            }
        }

        if(a + b == c){
            console.log('YES');
            continue;

        }if(b + c == a){
            console.log('YES');
            continue;

        }if(c + a == b){
            console.log('YES');
            continue;
        }
        console.log('NO');
    }
});

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');} function nextDoubleArray(size){return nextArray(size, 'double');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());} function nextDouble(){return parseFloat(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var list = nextIntArray(3);
		list.sort(function(a,b){
			return a - b;
		});
		var ok = false;
		for(var i = 0; i < list.length; i++){
			var L1 = list[i];
			var L2 = list[(i + 1) % 3];
			var L3 = list[(i + 2) % 3];
			if(L1 == L2 + L3){
				ok = true;
			}
			if(L1 % 2 == 0){
				if(L2 == L3){
					ok = true;
				}
			}
		}
		if(ok){
			myout("YES");
		}else{
			myout("NO");
		}
	}
}

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0; i < t; i++){
		let a = nl.nums();
		a.sort((a, b) => a - b);
		ans.push(a[0] + a[1] === a[2] || (a[0] === a[1] && a[2]%2 === 0) || (a[0]%2 === 0 && a[1] === a[2]));
	}
	console.log(ans.map(e => e?"YES":"NO").join('\n'));
};

process.stdin.on('end', sol);

var fs = require('fs'), currentline = 0, input = fs.readFileSync(0, 'utf8').trim().split('\n');
function readline() { return input[currentline++]; }
var T = +readline();
while (T--) {
    //let n = +readline();
    var nums = readline().split(' ').map(function (x) { return Number(x); });
    var l1 = nums[0], l2 = nums[1], l3 = nums[2];
    var ans = (l1 == l2 + l3) || (l2 == l1 + l3) || (l3 == l1 + l2); //lb
    var ans2 = (l1 % 2 == 0 && l2 == l3) || (l2 % 2 == 0 && l1 == l3) || (l3 % 2 == 0 && l1 == l2); //ll
    if (ans || ans2)
        console.log("YES");
    else
        console.log("NO");
}

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {

const x=+readline();
let s=[];
for(let i=0;i<x;i++){
    let y=readline().split(" ");
    if(parseInt(y[0])+parseInt(y[1])==parseInt(y[2])||parseInt(y[1])+parseInt(y[2])==parseInt(y[0])||parseInt(y[0])+parseInt(y[2])==parseInt(y[1])) s.push("YES");
    else if(parseInt(y[0])===parseInt(y[1]) && parseInt(y[2])%2===0) s.push("YES");
    else if(parseInt(y[2])===parseInt(y[1]) && parseInt(y[0])%2===0) s.push("YES");
    else if(parseInt(y[0])===parseInt(y[2]) && parseInt(y[1])%2===0) s.push("YES");
    else s.push("NO");
}

for(let i=0;i<s.length;i++){
    console.log(s[i]);

}
}

var tests =parseInt(readline());
for(var i=0 ; i<tests ; i++){

    var data =readline().split(" ").map(i => parseInt(i));
    if((data[0] === data[1] && data[2] %2 == 0) || (data[0] === data[2] && data[1] %2 ==0 ) || (data[1] === data[2] && data[0] %2 ==0)) print("YES");
    else if(data[0] + data[1] == data[2] || data[0] + data[2] == data[1] || data[1] + data[2] == data[0]) print("YES");
    else print("NO");
}

var count = parseInt(readline());

while (count--){
    var n = readline().split(" ").map(Number).sort();
    if (n[0] + n[1] === n[2]) {
        print("yes");
    }else if (n[0] === n[1] && (n[2] % 2 === 0)) {
        print("yes");
    }else if (n[1] === n[2] && (n[0] % 2 === 0)) {
        print("yes");
    }else{
        print("no");
    }
}

var tests =parseInt(readline());
for(var i=0 ; i<tests ; i++){

    var data =readline().split(" ").map(i => parseInt(i));
    if(((data[0] === data[1]) && data[2] %2 == 0) || ((data[0] === data[2]) && data[1] %2 ==0 ) || ((data[1] === data[2]) && data[0] %2 ==0)) {
        print("YES");

    }
    else{
        var largest = data.sort().reverse();
        if(largest[0] === largest[1]+largest[2]){
            print("YES");
        }
        else{
            print("NO");
        }
    }
}

var t = +readline()
for(var index = 1; index<=t; index++){
    var test = readline().split(' ')
    var a = +test[0]
    var b = +test[1]
    var c = +test[2]
    print(taskContext1(a,b,c))

}

function taskContext1(a,b,c) {

      var test = a+b+c
      if ((test) % 2 == 0 && test >= 4){
            return 'Yes'
      }else {
            return 'No'
      }

}

 var t = parseInt(readline());

  function check(val) {
    return val % 2 === 0
  }

  function solve() {
    var input = readline()
      .split(" ")
      .map((data) => +data).sort((a, b) => {
        if (a > b) {
          return 1;
        } else if (a < b) {
          return -1;
        } else {
          return 0;
        }
      });
    var val1 = input[0]
    var val2 = input[1]
    var val3 = input[2]

    if (val1 === val2) {
      if (!check(val3)) {
        return "NO"
      } else {
        return "YES"
      }
    } else if (val2 === val3) {
      if (!check(val1)) {
        return "NO"
      } else {
        return "YES"
      }
    } else if (val3 === val1) {
      if (!check(val2)) {
        return "NO"
      } else {
        return "YES"
      }
    }

    if (val1 < val3 && val2 < val3) {
      return "YES"
    }
    return "NO"
  }

  while (t--) {
    print(solve())
  }

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var test = readLine();
    while(test--)
    {
        var arr = readLine().split(" ").map((x) => {return parseInt(x)});
        arr.sort();
        var a = arr[0];
        var b = arr[1];
        var c = arr[2];
        var sum = a+b+c;
        if (a != b && b != c && a != c) {
            if (arr[2] === arr[1] + arr[0]) {
                console.log("YES");
            }
            else{
                console.log("NO");
            }
        }
        else {
            if ((sum)%2 === 0) {
                console.log("YES");
            }
            else{
                console.log("NO");
            }
        }

    }
    return 0;
}

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var test = readLine();
    while(test--)
    {
        var arr = readLine().split(" ").map((x) => {return parseInt(x)});
        arr.sort();
        var a = arr[0];
        var b = arr[1];
        var c = arr[2];
        if (a != b && b != c && a != c) {
            if (arr[2] === arr[1] + arr[0]) {
                console.log("YES");
            }
            else{
                console.log("NO");
            }
        }
        else {
            if ((a+b+c)%2 === 0) {
                console.log("YES");
            }
            else{
                console.log("NO");
            }
        }

    }
    return 0;
}

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var test = readLine();
    while(test--)
    {
        var arr = readLine().split(" ").map((x) => {return parseInt(x)});
        arr.sort();
        if (arr[0] != arr[1] && arr[1] != arr[2] && arr[2] != arr[0]) {
            if (arr[2] === arr[1] + arr[0]) {
                console.log("YES");
            }
            else{
                console.log("NO");
            }
        }
        else {
            if ((arr[0] + arr[1] + arr[2])%2 === 0) {
                console.log("YES");
            }
            else{
                console.log("NO");
            }
        }

    }
}

let l1, l2, l3;
if (l1 === l3 && l1 === l2){
    return console.log('Yes');
}

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => {
        let next;
        do {
            next = (await getLineGen.next());
        } while (!next.done && next.value === '');
        return next.value;
    };
})();

let solve = async () => {
    const tsc = parseInt(await getLine());
    for(let nsc = 0; nsc < tsc; nsc++) {
        const l = (await getLine()).split(' ').map(s => parseInt(s));
        l.sort((a,b) => (a - b));
        if (l[1] === l[2]) {
            if (l[0] % 2 === 0)
                console.log('YES');
            else
                console.log('NO');
        } else {
           if (l[0] + l[1] === l[2])  {
               console.log('YES');
           } else
               console.log('NO');
        }
    }
}

solve();