class Input:
    def __init__(self):
        from sys import stdin
        lines = stdin.readlines()
        self.lines = list([line.rstrip('\n') for line in reversed(lines) if line != '\n'])

    def input(self):
        return self.lines.pop()

    def input_int_list(self):
        return list(map(int, self.input().split()))

    def __bool__(self):
        return bool(self.lines)

inp = Input()
t = int(inp.input())

def box(qs):
    possible = set()
    max_added = 0
    result = []
    for q in qs:
        if q > max_added:
            possible |= set(range(max_added + 1, q))
            max_added = q
            result.append(q)
        elif not possible:
            return [-1]
        else:
            result.append(possible.pop())
    return result

for __ in range(t):
    n = int(inp.input())
    qs = inp.input_int_list()
    print(" ".join(map(str, box(qs))))


T = int(input())

def check(a, m):
    h = float('-inf')
    for i, a in enumerate(a):
        h = max(h, a)
        if h != m[i]: return False
    return True

for i in range(T):
    N = int(input())
    QS = list(map(int, input().split()))

    used = [False for i in range(N+1)]
    arr = [None for i in range(N)]
    arr[0] = QS[0]
    used[arr[0]] = True
    for i in range(1, N):
        if QS[i-1] != QS[i]:
            arr[i] = QS[i]
            used[arr[i]] = True

    cur = 0
    ind = 1
    while True:
        while cur < N and arr[cur] != None:
            cur += 1
        if cur == N: break
        while used[ind] == True: ind += 1
        arr[cur] = ind
        used[ind] = True

    if check(arr, QS):
        print(" ".join(map(str, arr)))
    else:
        print(-1)


#!/usr/bin/env python3
import sys
import heapq
input = sys.stdin.readline
INF = 10**9

t = int(input())
for i in range(t):
    n = int(input())
    q = [int(item) for item in input().split()]
    ans = [-1] * n
    prev = 0
    ok = True
    puttable = []
    for i, item in enumerate(q):
        if item < prev:
            ok = False
            break
        if item != prev:
            ans[i] = item
            for k in range(prev+1, item):
                heapq.heappush(puttable, k)
        elif item == prev:
            if len(puttable) == 0:
                ok = False
                break
            else:
                ans[i] = heapq.heappop(puttable)
        prev = item
    if ok:
        print(" ".join([str(item) for item in ans]))
    else:
        print(-1)


import sys
#input=sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right
import math
for _ in range(int(input())):
    n=int(input())
    l=list(map(int,input().split()))
    p=[0]*n
    f=0
    p[0]=l[0]
    x=dc(int)
    x[l[0]]=1
    for i in range(1,n):
        if l[i]<i+1:
            f=1
            break
        if l[i]!=l[i-1]:
            if x[l[i]]==1:
                f=1
                break
            else:
                x[l[i]]=1
                p[i]=l[i]
    if f:
        print(-1)
    else:
        i=0
        j=0
        q=[]
        for i in range(1,n+1):
            if x[i]==0:
                q.append(i)
        i=0
        while(i<len(q) and j<n):
            if p[j]==0:
                p[j]=q[i]
                i+=1
            j+=1
        print(*p)


from heapq import *

for _ in  range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))

    p = list(range(1, n + 1))

    u = [0] * n

    x = [a[0]]

    if a[0] == 1:
        heappop(p)
    else:
        u[a[0] - 1] = 1

    for i in range(1, n):
        if a[i] == a[i-1]:
            m = heappop(p)

            if m > a[i - 1]:
                print(-1)
                break

            while u[m - 1]:
                print(p)
                m = heappop(p)

                if m > a[i - 1]:
                    print(-1)
                    break

            else:
                u[m - 1] = 1
                x.append(m)
                continue

            break

        else:
            if a[i] < a[i - 1]:
                print(-1)
                break

            u[a[i] - 1] = 1
            x.append(a[i])

    else:
        print(*x)


from heapq import *

for _ in  range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))

    p = list(range(1, n + 1))

    u = [0] * n

    x = [a[0]]

    if a[0] == 1:
        heappop(p)
    else:
        u[a[0] - 1] = 1

    for i in range(1, n):
        if a[i] == a[i-1]:
            m = heappop(p)

            if m > a[i - 1]:
                print(-1)
                break

            while u[m - 1]:
                if m > a[i - 1]:
                    print(-1)
                    break

                m = heappop(p)

            else:
                u[m] = 1
                x.append(m)
                continue

            break

        else:
            if a[i] < a[i - 1]:
                print(-1)
                break

            u[a[i] - 1] = 1
            x.append(a[i])

    else:
        print(*x)


for _ in  range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))

    x = [a[0]]
    s = set(range(1, n+1))
    s.remove(a[0])

    for i in range(1, n):
        if a[i] == a[i-1]:
            m = min(s)

            if m > a[i - 1]:
                print(-1)
                break

            x.append(m)
            s.remove(m)

        else:
            if a[i] < a[i - 1]:
                print(-1)
                break

            x.append(a[i])
            s.remove(a[i])

    else:
        print(*x)


for _ in  range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))

    x = [a[0]]

    p = set(range(1, n+1))
    p.remove(a[0])

    for i in range(1, n):
        if a[i] == a[i-1]:
            d = p.pop()

            if d > a[i - 1]:
                print(-1)
                break

            x.append(d)
        else:
            x.append(a[i])

            if a[i] not in p:
                print(-1)
                break

            p.remove(a[i])
    else:
        print(*x)


from heapq import *

for _ in  range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))

    p = list(range(1, n + 1))

    u = [0] * n

    x = [a[0]]

    if a[0] == 1:
        heappop(p)
    else:
        u[a[0] - 1] = 1

    for i in range(1, n):
        if a[i] == a[i-1]:
            m = heappop(p)

            if m > a[i - 1]:
                print(-1)
                break

            while u[m - 1]:
                m = heappop(p)

                if m > a[i - 1]:
                    print(-1)
                    break

            else:
                u[m - 1] = 1
                x.append(m)
                continue

            break

        else:
            if a[i] < a[i - 1]:
                print(-1)
                break

            u[a[i] - 1] = 1
            x.append(a[i])

    else:
        print(*x)


for _ in  range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))

    x = [a[0]]
    p = list(range(1, n+1))

    p.pop(a[0] - 1)

    for i in range(1, n):
        if a[i] == a[i-1]:
            d = p.pop(0)

            if a[i-1] < d:
                print(-1)
                break

            x.append(d)
        else:
            x.append(a[i])
            p.remove(a[i])
    else:
        print(*x)


for _ in  range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))

    x = [a[0]]

    u = [1] * n
    u[a[0] - 1] = 0

    c = 0

    if u[0] == 0:
        c += 1

    for i in range(1, n):
        if a[i] == a[i-1]:
            x.append(c + 1)

            while u[c] != 0:
                c += 1

                if c == n:
                    print(-1)
                    break
            else:
                continue

            break

        else:
            if a[i - 1] > a[i]:
                print(-1)
                break

            u[a[i] - 1] = 0
            x.append(a[i])
    else:
        print(*x)


import math
q=int(input())
#q=1
for _ in range(q):
    n=int(input())
    l=list(map(int,input().split()))
    a=[0]*(n+1)
    for i in range(n):
        a[l[i]]+=1
    #print(a)
    flag=True
    for i in range(n+1):
        if a[i]>i:
            print(-1)
            flag=False
            break
    if flag:
        fill=[]
        for i in range(1,n+1):
            if a[i]==0:
                fill.append(i)
        i=n-1
        while(i>=0):
            if a[l[i]]>1:
                a[l[i]]-=1
                l[i]=fill[-1]
                fill.pop()
            i-=1
        print(*l)


import math
q=int(input())
#q=1
for _ in range(q):
    n=int(input())
    l=list(map(int,input().split()))
    maxx=max(l)
    a=[0]*(n+1)
    for i in range(n):
        a[l[i]]+=1
    #print(a)
    flag=True
    for i in range(n+1):
        if a[i]>i:
            print(-1)
            flag=False
            break
    if flag:
        fill=[]
        for i in range(1,n+1):
            if a[i]==0:
                fill.append(i)
        i=n-1
        while(i>=0):
            if a[l[i]]>1:
                a[l[i]]-=1
                l[i]=fill[-1]
                fill.pop()
            i-=1
        for i in range(n):
            if l[i]>maxx:
                print(-1)
                flag=False
                break
        if flag:
            print(*l)


import math
q=int(input())
#q=1
for _ in range(q):
    n=int(input())
    l=list(map(int,input().split()))
    l1=l.copy()
    maxx=max(l)
    a=[0]*(n+1)
    for i in range(n):
        a[l[i]]+=1
    #print(a)
    flag=True
    for i in range(n+1):
        if a[i]>i:
            print(-1)
            flag=False
            break
    if flag:
        fill=[]
        for i in range(1,n+1):
            if a[i]==0:
                fill.append(i)
        i=n-1
        while(i>=0):
            if a[l[i]]>1:
                a[l[i]]-=1
                l[i]=fill[-1]
                fill.pop()
            i-=1
        for i in range(n):
            if l[i]>l1[i]:
                print(-1)
                flag=False
                break
        if flag:
            print(*l)


#602_B

t = int(input())

for i in range(0, t):
    n = int(input())
    ln = [int(j) for j in input().split(" ")]
    taken = {}
    inds = {}
    pm = [0] * (n)
    pm[0] = ln[0]
    taken[ln[0]] = True
    inds[0] = True
    nt = []
    ni = []
    for j in range(1, n):
        if ln[j] > ln[j - 1]:
            pm[j] = ln[j]
            taken[ln[j]] = True
            inds[j] = True
    for j in range(1, n + 1):
        if j not in taken:
            nt.append(j)
        if j - 1 not in inds:
            ni.append(j)
    f = True
    for j in range(0, len(nt)):
        pm[ni[j] - 1] = nt[j]
        if nt[j] > ln[ni[j] - 1]:
            f = False
    if f:
        print(" ".join([str(j) for j in pm]))
    else:
        print(-1)


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

# sys.setrecursionlimit(200000)
# mod = 10**9+7
# mod = 998244353
decimal.getcontext().prec = 46

def primeFactors(n):
    prime = set()
    while n % 2 == 0:
        prime.add(2)
        n = n//2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            prime.add(i)
            n = n//i
    if n > 2:
        prime.add(n)
    return list(prime)

def getFactors(n) :
    factors = []
    i = 1
    while i <= math.sqrt(n):
        if (n % i == 0) :
            if (n // i == i) :
                factors.append(i)
            else :
                factors.append(i)
                factors.append(n//i)
        i = i + 1
    return factors

def SieveOfEratosthenes(n):
    prime = [True for i in range(n+1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    num = []
    for p in range(2, n+1):
        if prime[p]:
            num.append(p)
    return num

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

def sort_dict(key_value):
    return sorted(key_value.items(), key = lambda kv:(kv[1], kv[0]))

def list_input():
    return list(map(int,input().split()))

def num_input():
    return map(int,input().split())

def string_list():
    return list(input())

def decimalToBinary(n):
    return bin(n).replace("0b", "")

def binaryToDecimal(n):
    return int(n,2)

def DFS(n,s,adj):
    visited = [False for i in range(n+1)]
    stack = []
    stack.append(s)

    while (len(stack)):
        s = stack[-1]
        stack.pop()

        if (not visited[s]):
            visited[s] = True

        for node in adj[s]:
            if (not visited[node]):
                stack.append(node)

def solve():
    n = int(input())
    arr = list_input()
    num = [False]*(n+1)
    indx = 1
    ans = [arr[0]]
    num[arr[0]] = True
    for i in range(1,n):
        if arr[i] < ans[-1]:
            print(-1)
            return
        elif arr[i] == ans[-1]:
            flag = False
            while num[indx] < arr[i]:
                if not(num[indx]):
                    flag = True
                    ans.append(indx)
                    indx += 1
                    break
                else:
                    indx += 1
            if not(flag):
                print(-1)
                return
        else:
            ans.append(arr[i])
            num[arr[i]] = True
    for i in ans:
        print(i,end=' ')
    print()

t = int(input())
#t = 1
for _ in range(t):
    solve()


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

# sys.setrecursionlimit(200000)
# mod = 10**9+7
# mod = 998244353
decimal.getcontext().prec = 46

def primeFactors(n):
    prime = set()
    while n % 2 == 0:
        prime.add(2)
        n = n//2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            prime.add(i)
            n = n//i
    if n > 2:
        prime.add(n)
    return list(prime)

def getFactors(n) :
    factors = []
    i = 1
    while i <= math.sqrt(n):
        if (n % i == 0) :
            if (n // i == i) :
                factors.append(i)
            else :
                factors.append(i)
                factors.append(n//i)
        i = i + 1
    return factors

def SieveOfEratosthenes(n):
    prime = [True for i in range(n+1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    num = []
    for p in range(2, n+1):
        if prime[p]:
            num.append(p)
    return num

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

def sort_dict(key_value):
    return sorted(key_value.items(), key = lambda kv:(kv[1], kv[0]))

def list_input():
    return list(map(int,input().split()))

def num_input():
    return map(int,input().split())

def string_list():
    return list(input())

def decimalToBinary(n):
    return bin(n).replace("0b", "")

def binaryToDecimal(n):
    return int(n,2)

def DFS(n,s,adj):
    visited = [False for i in range(n+1)]
    stack = []
    stack.append(s)

    while (len(stack)):
        s = stack[-1]
        stack.pop()

        if (not visited[s]):
            visited[s] = True

        for node in adj[s]:
            if (not visited[node]):
                stack.append(node)

def solve():
    n = int(input())
    arr = list_input()
    num = [False]*(n+1)
    indx = 1
    ans = [arr[0]]
    num[arr[0]] = True
    for i in range(1,n):
        if arr[i] < ans[-1]:
            print(-1)
            return
        elif arr[i] == ans[-1]:
            flag = False
            while indx < arr[i]:
                if not(num[indx]):
                    flag = True
                    ans.append(indx)
                    indx += 1
                    break
                else:
                    indx += 1
            if not(flag):
                print(-1)
                return
        else:
            if not(num[arr[i]]):
                ans.append(arr[i])
                num[arr[i]] = True
            else:
                flag = False
                while indx < arr[i]:
                    if not(num[indx]):
                        flag = True
                        ans.append(indx)
                        indx += 1
                        break
                    else:
                        indx += 1
                if not(flag):
                    print(-1)
                    return

    for i in ans:
        print(i,end=' ')
    print()

t = int(input())
#t = 1
for _ in range(t):
    solve()


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

# sys.setrecursionlimit(200000)
# mod = 10**9+7
# mod = 998244353
decimal.getcontext().prec = 46

def primeFactors(n):
    prime = set()
    while n % 2 == 0:
        prime.add(2)
        n = n//2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            prime.add(i)
            n = n//i
    if n > 2:
        prime.add(n)
    return list(prime)

def getFactors(n) :
    factors = []
    i = 1
    while i <= math.sqrt(n):
        if (n % i == 0) :
            if (n // i == i) :
                factors.append(i)
            else :
                factors.append(i)
                factors.append(n//i)
        i = i + 1
    return factors

def SieveOfEratosthenes(n):
    prime = [True for i in range(n+1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    num = []
    for p in range(2, n+1):
        if prime[p]:
            num.append(p)
    return num

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

def sort_dict(key_value):
    return sorted(key_value.items(), key = lambda kv:(kv[1], kv[0]))

def list_input():
    return list(map(int,input().split()))

def num_input():
    return map(int,input().split())

def string_list():
    return list(input())

def decimalToBinary(n):
    return bin(n).replace("0b", "")

def binaryToDecimal(n):
    return int(n,2)

def DFS(n,s,adj):
    visited = [False for i in range(n+1)]
    stack = []
    stack.append(s)

    while (len(stack)):
        s = stack[-1]
        stack.pop()

        if (not visited[s]):
            visited[s] = True

        for node in adj[s]:
            if (not visited[node]):
                stack.append(node)

def solve():
    n = int(input())
    arr = list_input()
    num = [False]*(n+1)
    indx = 1
    ans = [arr[0]]
    num[arr[0]] = True
    for i in range(1,n):
        if arr[i] < ans[-1]:
            print(-1)
            return
        elif arr[i] == ans[-1]:
            flag = False
            while num[indx] < arr[i]:
                if not(num[indx]):
                    flag = True
                    ans.append(indx)
                    indx += 1
                    break
                else:
                    indx += 1
            if not(flag):
                print(-1)
                return
        else:
            if not(num[arr[i]]):
                ans.append(arr[i])
                num[arr[i]] = True
            else:
                flag = False
                while num[indx] < arr[i]:
                    if not(num[indx]):
                        flag = True
                        ans.append(indx)
                        indx += 1
                        break
                    else:
                        indx += 1
                if not(flag):
                    print(-1)
                    return

    for i in ans:
        print(i,end=' ')
    print()

t = int(input())
#t = 1
for _ in range(t):
    solve()


def solve():
    n = int(input())
    arr = [0] * n
    used = [0] * (n + 1)
    cur = 0
    ad = 1
    for i, el in enumerate(map(int, input().split())):
        if el < cur or el > n:
            print(-1)
            return
        while ad <= n and used[ad] == 1:
            ad += 1
        if used[el] == 0:
            used[el] = 1
            arr[i] = el
            cur = el
        elif ad < el:
            used[ad] = 1
            arr[i] = ad
        else:
            print(-1)
            return
    print(*arr)
    return

t = int(input())
for _ in range(t):
    solve()


t = int(input())
for _ in range(t):
    n = int(input())
    arr = [0] * n
    cur = 0
    ad = 1
    flag = False
    for i, el in enumerate(map(int, input().split())):
        if el < ad or el < cur:
            flag = True
            break
        if el > cur:
            arr[i] = el
            cur = el
            if el == ad:
                ad += 1
        else:
            arr[i] = ad
            ad += 1
    if flag:
        print(-1)
    else:
        print(*arr)


for _ in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    s=set([i for i in range(n,0,-1)])

    ans=[arr[0]]
    s.remove(arr[0])
    f=0
    for i in range(1,n):
        if arr[i]==arr[i-1]:
            x=min(s)
            if x<arr[i]:
                ans.append(x)
                s.remove(x)
            else:
                f=1
                break
        else:
            ans.append(arr[i])
            s.remove(arr[i])

    if f==1:
        print(-1)
    else:
        print(*ans)


import heapq
for _ in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    vis=[i for i in range(1,n+1)]
    s=set([arr[0]])

    ans=[arr[0]]
    f=0
    for i in range(1,n):
        if arr[i]==arr[i-1]:
            x=heapq.heappop(vis)
            while x in s:
                x=heapq.heappop(vis)
            if x<arr[i]:
                ans.append(x)
            else:
                f=1
                break
        else:
            ans.append(arr[i])
            s.add(arr[i])

    if f==1:
        print(-1)
    else:
        print(*ans)


import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))

t,=I()
for _ in range(t):
	n,=I()
	l=I()
	an=[l[0]]
	d=[1]*n;d[l[0]-1]=0
	ct= 1 if d[0] else 2
	for i in range(1,n):
		if l[i-1]<l[i]:
			an.append(l[i])
			d[l[i]-1]=0
		elif l[i-1]>l[i] or l[i]<=i:
			an=[-1];break
		else:
			while ct<n+1 and d[ct-1]==0 :
				ct+=1
			an.append(ct)
			if ct==n+1:
				an=[-1];break
			d[ct-1]=0
	if 1 in d:
		an=[-1]
	print(*an)


for _ in range(int(input())):
    n=int(input())
    q=list(map(int,input().split()))
    p=[-1]*n
    p[0]=q[0]
    check=[0]*n
    check[p[0]-1]=1
    now=0 if p[0]!=1 else 1
    for i in range(1,n):
        if q[i]!=q[i-1]:
            if check[q[i]-1]:
                print(-1)
                break
            else:
                check[q[i]-1]=1
                p[i]=q[i]
        else:
            while True:
                if not check[now]:
                    check[now]=1
                    p[i]=now+1
                    now+=1
                    break
            if q[i]<p[i]:
                print(-1)
                break
    else:
        print(" ".join(map(str,p)))


import sys
input=sys.stdin.readline
for _ in range(int(input())):
    n=int(input())
    q=list(map(int,input().split()))
    p=[-1]*n
    p[0]=q[0]
    check=[0]*n
    check[p[0]-1]=1
    now=0 if p[0]!=1 else 1
    for i in range(1,n):
        if q[i]!=q[i-1]:
            if check[q[i]-1]:
                print(-1)
                break
            else:
                check[q[i]-1]=1
                p[i]=q[i]
        else:
            while True:
                if not check[now]:
                    check[now]=1
                    p[i]=now+1
                    break
                now+=1
            if q[i]<p[i]:
                print(-1)
                break
    else:
        print(" ".join(map(str,p)))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
    n=int(input())
    q=list(map(int,input().split()))
    p=[-1]*n
    p[0]=q[0]
    check=[0]*n
    check[p[0]-1]=1
    now=0 if p[0]!=1 else 1
    for i in range(1,n):
        if q[i]!=q[i-1]:
            if check[q[i]-1]:
                print(-1)
                break
            else:
                check[q[i]-1]=1
                p[i]=q[i]
        else:
            while True:
                if not check[now]:
                    check[now]=1
                    p[i]=now+1
                    now+=1
                    break
            if q[i]<p[i]:
                print(-1)
                break
    else:
        print(" ".join(map(str,p)))


t = int(input())
while t:
    t -= 1
    freq = {}
    n = int(input())
    a = list(map(int, input().split()))
    ans = [a[0]]
    prev = a[0]
    freq[a[0]] = 1
    possible = 1
    nxt = [i for i in range(100001)]
    for i in range(1, n):
        found = 0
        if prev < a[i]:
            ans.append(a[i])
            freq[a[i]] = 1
            nxt[i] = nxt[i]-1
        else:
            j = nxt[i]
            while j > 0:
                if not j in freq:
                    freq[j] = 1
                    ans.append(j)
                    found = 1
                    nxt[i] = j-1
                    break
                j -= 1
            if not found:
                possible = 0
                break
        prev = a[i]
    if not possible:
        print(-1)
    else:
        print(*ans)


t = int(input())
while t:
    t -= 1
    freq = {}
    n = int(input())
    a = list(map(int, input().split()))
    ans = [a[0]]
    prev = a[0]
    freq[a[0]] = 1
    possible = 1
    nxt = [i for i in range(n+1)]
    nxt[a[0]] = a[0]-1
    for i in range(1, n):
        found = 0
        if prev < a[i]:
            ans.append(a[i])
            freq[a[i]] = 1
            nxt[a[i]] = nxt[a[i]]-1
        else:
            j = nxt[a[i]]
            while j > 0:
                if not j in freq:
                    freq[j] = 1
                    ans.append(j)
                    found = 1
                    nxt[a[i]] = j
                    break
                j = min(nxt[a[j]], j-1)
            if not found:
                possible = 0
                break
        prev = a[i]
        # print(nxt)
    if not possible:
        print(-1)
    else:
        print(*ans)


t = int(input())
while t:
    t -= 1
    freq = {}
    n = int(input())
    a = list(map(int, input().split()))
    ans = [a[0]]
    prev = a[0]
    freq[a[0]] = 1
    possible = 1
    start = 1
    for i in range(1, n):
        found = 0
        if prev < a[i]:
            ans.append(a[i])
            freq[a[i]] = 1
        elif prev > a[i]:
            possible = 0
            break
        else:
            while start <= a[i]:
                if not start in freq:
                    found = 1
                    ans.append(start)
                    freq[start] = 1
                    break
                start += 1
            if not found:
                possible = 0
                break
        prev = a[i]
        # print(nxt)
    if not possible:
        print(-1)
    else:
        print(*ans)


t = int(input())
while t:
    t -= 1
    freq = {}
    n = int(input())
    a = list(map(int, input().split()))
    ans = [a[0]]
    prev = a[0]
    freq[a[0]] = 1
    possible = 1
    for i in range(1, n):
        found = 0
        if prev < a[i]:
            ans.append(a[i])
            freq[a[i]] = 1
        else:
            j = a[i]-1
            while j > 0:
                if not j in freq:
                    freq[j] = 1
                    ans.append(j)
                    found = 1
                    break
                j -= 1
            if not found:
                possible = 0
                break
        prev = a[i]
    if not possible:
        print(-1)
    else:
        print(*ans)


t = int(input())
while t:
    t -= 1
    freq = {}
    n = int(input())
    a = list(map(int, input().split()))
    ans = [a[0]]
    prev = a[0]
    freq[a[0]] = 1
    possible = 1
    nxt = [i for i in range(n+1)]
    nxt[1] = 0
    for i in range(1, n):

        found = 0
        if prev < a[i]:
            ans.append(a[i])
            freq[a[i]] = 1
            nxt[a[i]] = nxt[a[i]]-1
        else:
            j = nxt[a[i]]
            while j > 0:
                if not j in freq:
                    freq[j] = 1
                    ans.append(j)
                    found = 1
                    nxt[a[i]] = j
                    break
                j -= 1
            if not found:
                possible = 0
                break
        prev = a[i]
        # print(nxt)
    if not possible:
        print(-1)
    else:
        print(*ans)


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : map(int, input().split())
def write(*args, sep="\n"):
  for i in args:
    sys.stdout.write("{}{}".format(i, sep))
INF = float('inf')
MOD = int(1e9 + 7)

for _ in range(int(input())):
  n = int(input())
  arr = list(read())
  ans = [-1] * n

  s = set(range(1, n + 1))
  s = sorted(list(s.difference(set(arr))))
  j = 0

  flag = True
  ans[0] = arr[0]
  for i in range(1, n):
    if arr[i] == arr[i - 1]:
      if s[j] > arr[i]:
        flag = False
        break
      else:
        ans[i] = s[j]
        j += 1
    else:
      ans[i] = arr[i]

  if flag:
    print(*ans)
  else:
    print("-1")


import math
def solve():
  n = int(input())
  l = list(map(int,input().split()))
  s = set([l[0]])
  c = 1
  ans = [l[0]]
  for i in range(1,n):
    if l[i] in s:
      while(c in s):
        c+=1
      if(c<l[i]):
        ans.append(c)
        s.add(c)
      else:
        return [-1]
    else:
      ans.append(l[i])
      s.add(l[i])
  return ans
for _ in range(int(input())):
  print(*solve())


import math
def solve():
  n = int(input())
  l = list(map(int,input().split()))
  rp = l[0]
  lp = rp-1
  v = [0 for _ in range(n+1)]
  ans = []
  ans.append(rp)
  v[rp] = 1
  for i in range(1,n):
    if(l[i]>rp):
      ans.append(l[i])
      v[l[i]]=1
      lp += l[i]-rp-1
      rp = l[i]
    else:
      if(lp>0):
        lp-=1
      else:
        return [-1]
  for i in range(1,n+1):
    if(v[i]==0):
      ans.append(i)
  return ans

for _ in range(int(input())):
  print(*solve())


for qq in range(int(input())):
    n = int(input())
    a=list(map(int, input().split()))
    curmax = 0
    min_not_in = 1
    poss = True
    x=set()
    y=[]
    def inc(m, x):
        while m in x:
            m+=1
        return m
    maxel = 0
    for i in range(n):
        el = a[i]
        if el < curmax:
            print(-1)
            poss = False
            break
        curmax = el
        if curmax not in x:
            x.add(curmax)
            y+=[curmax]
            if curmax > maxel: maxel = curmax
            e2 = curmax
        else:
            x.add(min_not_in)
            y+=[min_not_in]
            if min_not_in > maxel: maxel = min_not_in
            e2 = min_not_in
        min_not_in = inc(min_not_in, x)
        if maxel > el:
            poss = False
    if not poss:
        print(-1)
        continue
    print(" ".join(str(k) for k in y))


t = int(input())
for i in range(t):
    n = int(input())
    p = []
    q = list(map(int,input().split()))
    used = [0]*(n+1)
    cur = 0
    m = 1
    for i in range(n):
        if q[i] > cur:
            p.append(q[i])
            used[q[i]] = 1
            cur = q[i]
        else:
            while used[m]:
                m += 1
            if q[i] < m:
                print(-1)
                break
            p.append(m)
            used[m] = 1
    else:
        print(*p)


t = int(input())
def calcAns(q):
    smallestUnused = 1
    ans = []
    used = [False for i in range(len(q)+1)]
    mx = -1
    for j in range(len(q)):
        if q[j] < j+1:
            return -1
        if q[j] > mx:
            ans.append(q[j])
            mx = q[j]
            used[q[j]] = True
        else:
            while used[smallestUnused] == True:
                smallestUnused += 1
            ans.append(smallestUnused)
            smallestUnused += 1
    return ans
for i in range(t):
    n = int(input())
    q = list(map(int, input().strip().split()))
    ans = calcAns(q)
    if ans == -1:
        print(-1)
    else:
        for j in ans:
            print(j, end = " ")
        print()


from collections import Counter

t = int(input())
for a in range(t):
    n = int(input())
    q = [int(i) for i in input().split()]
    qn = Counter(q)
    qa = q.copy()
    miss = [i for i in range(1,len(q)+1) if i not in qn]
    if len(miss) == 0:
        print(" ".join(map(str, q)))
    else:
        ma = q[0]
        pos = True
        i = 0
        for a in range(len(q)):
            ma = max(ma, qa[a])
            # print(ma)

            if qn.get(q[a]) > 1:
                if miss[i] < ma:
                    qa[qa.index(q[a],a+1)] = miss[i]
                else:
                    pos = False
                    break
                i += 1
                qn[q[a]] -= 1

        if pos:
            print(" ".join(map(str, qa)))
        else:
            print(-1)


t = int(input())
for a in range(t):
    n = int(input())
    q = [int(i) for i in input().split()]
    qa = q.copy()
    miss = [i for i in range(1,len(q)+1) if i not in q]
    if len(miss) == 0:
        print(" ".join(map(str, q)))
    else:
        ma = q[0]
        pos = True
        i = 0
        for a in range(len(q)):
            ma = max(ma, qa[a])
            # print(ma)

            if qa.count(q[a]) > 1:
                if miss[i] < ma:
                    qa[qa.index(q[a],a+1)] = miss[i]
                else:
                    pos = False
                    break
                i += 1

        if pos:
            print(" ".join(map(str, qa)))
        else:
            print(-1)


def solve():
	t = 1
	for i in range(1, n + 1):
		if a[i] > a[i - 1]:
			b[i] = a[i]
		elif a[i] == a[i - 1]:
			while t <= n and vis[t]:
				t += 1
			if t > a[i]:
				print(-1)
				return
			b[i] = t
		else:
			print(-1)
			return
		vis[b[i]] = True
	for i in range(1, n + 1):
		print(b[i], end=' ' if i < n else '\n')

t = int(input())
for ti in range(1, t + 1):
	n = int(input())
	a = [0] + list(map(int, input().split()))
	b = [0] * (n + 1)
	vis = [False] * (n + 1)
	solve()


# def bs(hi):
#     lo = -1
#     hi += 1
#     while lo + 1 < hi:
#         mid = (lo + hi) >> 1
#         if visited[mid]:
#             hi = mid
#         else:
#             lo = mid
#     return lo + 1

def find(x):
    if parent[x] < 0:
        return x
    parent[x] = find(parent[x])
    return parent[x]

def merge(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return x
    if x > y:
        parent[x] = y
        return y
    else:
        parent[y] = x
        return x

if __name__ == '__main__':
    input = __import__('sys').stdin.readline
    T = int(input())

    for _ in range(T):
        N = int(input())
        data = list(map(int,input().split()))
        parent = [-1 for _ in range(N + 1)]
        visited = [False for _ in range(N + 1)]
        res = list()
        flag = True
        # prev = data[0]

        for num in data:
            if not(1 <= num <= N):
                flag = False
                break
            idx = find(num)
            if not (1 <= idx <= N):
                flag = False
                break
            merge(idx, idx - 1)
            visited[idx] = True
            res.append(idx)

        if flag:
            print(' '.join(map(str,res)))
        else:
            print(-1)


#!/usr/bin/python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    t = int(input())
    for _ in range(t):
        n = int(input())
        a = list(map(int, input().split()))
        res = [a[0]]
        pre = a[0]
        b = [False for i in range(n+1)]
        b[a[0]] = True
        x = 1
        flag = True
        for i in range(1, n):
            if flag == False:
                break
            if a[i]==pre:
                pre = a[i]
                while b[x]==True and x<n:
                    x += 1
                if x>a[i]:
                    print(-1)
                    flag = False
                    continue
                res.append(x)
                b[x] = True
            else:
                res.append(a[i])
                pre = a[i]
                b[a[i]] = True

        if flag:
            for i in res:
                print(i,end=" ")
            print()


#!/usr/bin/python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    t = int(input())
    for _ in range(t):
        n = int(input())
        a = list(map(int, input().split()))
        res = [a[0]]
        pre = a[0]
        flag = True
        for i in range(1, n):
            if flag == False:
                break
            if a[i]==pre:
                pre = a[i]
                b = list(set(range(1, pre)).difference(set(res)))
                if len(b)==0:
                    print(-1)
                    flag = False
                    continue
                res.append(b[0])
            else:
                res.append(a[i])
                pre = a[i]
            if flag == False:
                break
        if flag:
            for i in res:
                print(i,end=" ")
            print()


from collections import defaultdict as dd
t=int(input())
while t:
    n=int(input())
    res=[-1]*n
    l=list(map(int,input().split()))
    res[0]=l[0]
    has=[1]*(n+1)
    has[l[0]]=0
    av=[]
    for i in range(1,n):
        if(l[i]>l[i-1]):
            res[i]=l[i]
            has[l[i]]=0
    for i in range(1,n+1):
        if(has[i]):
            av.append(i)
    i=0
    j=0
    while i<len(av) and j<len(res):
        if(res[j]==-1):
            res[j]=av[i]
            i+=1
        j+=1
    mx=-1
    lol=0
    #print(res)
    for i in range(n):
        mx=max(mx,res[i])
        if(mx!=l[i]):
            lol=1
            #print(mx,l[i],i,"lol")
            break
        if(res[i]==-1):
            lol=1
            break
    if(lol):
        print(-1)
    else:
        print(*res)
    t-=1


#!/usr/bin/env python3

t = int(input())
for _ in range(t):
    n = int(input())
    maximums = list(map(int, input().split()))
    permutation = [0] * n
    number_is_used = [False] * n
    last_max = -1
    for i, m in enumerate(maximums):
        if m > last_max:
            permutation[i] = m
            last_max = m
            number_is_used[m - 1] = True
        else:
            permutation[i] = -last_max

    # print('permutation', permutation)
    # print('num is used', number_is_used)

    ind_to_insert = 0
    for num_to_insert in range(1, n + 1):
        if number_is_used[num_to_insert - 1]:
            continue
        while permutation[ind_to_insert] > 0:
            ind_to_insert += 1
        if num_to_insert > abs(permutation[ind_to_insert]):
            break
        permutation[ind_to_insert] = num_to_insert
        number_is_used[num_to_insert - 1] = True
    # print(number_is_used)
    if not all(number_is_used):
        print(-1)
    else:
        print(" ".join(map(str, permutation)))


from __future__ import print_function

t = int(input())

for _ in range(t):
    n = int(input())
    have = [False for _ in range(n+1)]
    have[0] = True
    last_have = 0
    Q = [int(x) for x in input().split()]
    last = 0
    res = []
    for q in Q:
        if q > last:
            res.append(q)
            have[q] = True
            last = q
        elif q == last:
            if q < len(res)+1:
                print(-1)
                break
            while have[last_have] == True:
                last_have += 1
            res.append(last_have)
            have[last_have] = True
        else:
            print(-1)
            break
    for x in res:
        print(x, end = " ")
    print()


from __future__ import print_function

t = int(input())

for _ in range(t):
    n = int(input())
    have = [False for _ in range(n+1)]
    have[0] = True
    last_have = 0
    Q = [int(x) for x in input().split()]
    last = 0
    res = []
    for q in Q:
        if q > last:
            res.append(q)
            have[q] = True
            last = q
        elif q == last:
            if q < len(res)+1:
                print(-1)
                break
            while have[last_have] == True:
                last_have += 1
            res.append(last_have)
            have[last_have] = True
        else:
            print(-1)
            break
    else:
        for x in res:
            print(x, end = " ")
        print()


t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    vis={}
    for i in range(1,n+1):
        vis[i]=True
    ans=[-1 for i in range(n)]
    ans[0]=a[0]
    vis.pop(ans[0])
    i=1
    if n ==1:
        print(1)
    else:
        while i<n:
            if a[i]>a[i-1]:
                ans[i]=a[i]
                vis.pop(ans[i])
            i +=1
        cnt=0
        for i in range(1,n-1):
            if ans[i]==-1:
                cnt += 1
        if cnt >0:
            print(-1)
        elif ans[-1]==-1 and len(vis)>1:
            print(-1)
        else:
            for i in vis:
                ans[-1]=i
            print(" ".join(map(str,ans)))


t=int(input())
for _ in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    vis={}
    for i in range(1,n+1):
        vis[i]=True
    ok=True
    ans=[-1 for i in range(n)]
    ans[0]=a[0]
    vis.pop(a[0])
    for i in range(1,n):
        if a[i]<=i:
            ok=False
            break
        if a[i]>a[i-1]:
            ans[i]=a[i]
            vis.pop(a[i])
    if ok:
        i=0
        aa=[]
        for i in vis:
            aa.append(i)
        aa=sorted(aa)
        if len(aa)== 0:
            print(" ".join(map(str,ans)))
        else:
            j=0
            i=0
            while j<n:
                if ans[j] == -1:
                    ans[j]=aa[i]
                    i+=1
                j += 1
            print(" ".join(map(str,ans)))
    else:
        print(-1)


from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

T = inp()
for t in range(T):
    N = inp()
    aa = inpl()
    ans = [-1]*N
    koho = [True]*N
    koho_i = 0
    ba = -1
    for i,a in enumerate(aa):
        if a <= i:
            print(-1)
            break
        else:
            if ba != a:
                ans[i] = a
                koho[a-1] = False
            else:
                while koho[koho_i] == False:
                    koho_i += 1
                ans[i] = koho_i + 1
                koho[koho_i] = False

        ba = a
    else:
        print(' '.join(map(str,ans)))


t=int(input())
for a in range(t):
	n=int(input())
	list1=list(map(int,input().split()))
	now=0
	sign=0
	ans=[0]*n
	use=[0]*n
	for a in range(0,n):
		if list1[a]<=a:
			sign=-1
			break
		if list1[a]<now:
			tag=-1
			break
		if list1[a]>now:
			ans[a]=list1[a]
			use[list1[a]-1]=1
			now=list1[a]
	if sign==-1:
		print(-1)
	else:
		ll1=[]
		ll2=[]
		for a in range(n):
			if use[a]==0:
				ll1.append(a)
			if ans[a]==0:
				ll2.append(a)
		for a in range(0,len(ll1)):
			ans[ll2[a]]=ll1[a]+1
		for a in ans:
			print(a,end=' ')


t=int(input())
for a in range(t):
	n=int(input())
	list1=list(map(int,input().split()))
	now=0
	sign=0
	ans=[0]*n
	use=[0]*n
	for a in range(0,n):
		if list1[a]<=a:
			sign=-1
			break
		if list1[a]<now:
			tag=-1
			break
		if list1[a]>now:
			ans[a]=list1[a]
			use[list1[a]-1]=1
			now=list1[a]
	if sign==-1:
		print(-1)
	else:
		ll1=[]
		ll2=[]
		for a in range(n):
			if use[a]==0:
				ll1.append(a)
			if ans[a]==0:
				ll2.append(a)
		for a in range(0,len(l1)):
			ans[ll2[a]]=ll1[a]+1
		for a in ans:
			print(a,end=' ')


n=int(input())
list1=list(map(int,input().split()))
m=int(input())
list2=[]
for a in range(n):
	h.append([l[a],-(a+1)])
list2=sorted(list2,reverse=True)
for a in range(m):
	p,pos=map(int,input().split())
	list3=listh[:p]
	list3=sorted(list3,key=lambda x:x[1],reverse=True)
	print(list3[pos-1][0])


n=int(input())
for i in range(n):
    x=int(input())
    mlist=[int(x) for x in input().split(' ')]
    alist=[]
    ans=[]
    for i in range(1,x+1):
        alist.append(i)
    ans.append(mlist[0])
    alist.remove(mlist[0])
    yon=0
    for i in range(x-1):
        if (mlist[i+1] < i+2) or (mlist[i+1] < mlist[i]):
            print(-1)
            yon=1
        elif (mlist[i+1] == mlist[i]):
            ans.append(alist[0])
            alist.remove(alist[0])
        elif (mlist[i+1] > mlist[i]):
            ans.append(mlist[i+1])
            alist.remove(mlist[i+1])
    if yon==0:
        ans=[str(x) for x in ans]
        print(' '.join(ans))


import sys
import collections
import heapq
import math

input = sys.stdin.readline

def rints(): return map(int, input().strip().split())
def rstr(): return input().strip()
def rint(): return int(input().strip())
def rintas(): return [int(i) for i in input().strip().split()]

def gcd(a, b):
    if (b == 0):
         return a
    return gcd(b, a%b)

t = rint()
for _ in range(t):
    n = rint()
    q = rintas()
    d = [0]*n
    ans = []
    cur, idx = 0, 0
    cont = True
    for i, v in enumerate(q):
        if not cont: break
        if i == 0 or v > cur:
            ans.append(str(v))
            d[v-1] = 1
        else:
            while idx < n and d[idx]:
                idx += 1
            if idx+1 < v:
                ans.append(str(idx+1))
                d[idx] = 1
            else:
                cont = False
                break
        cur = v

    if not cont:
        print(-1)
    else:
        print(' '.join(ans))


t=int(input())

for i in range(t):
    r=[]
    f=[]
    decision=1
    prev_max=0
    n=int(input())
    q=list(map(int,input().split()))

    for k in q:
        if k>prev_max:
            r.append(k)
            for j in range(1,k-prev_max):
                f.append(prev_max+j)
            prev_max=k
        else:
            if len(f)>0:
                r.append(f.pop())
            else:
                decision=-1
                break

    if decision==-1:
        print(-1)
    else:
        print(*r)


for _ in range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))
    ans = [0]*n
    rem = sorted(set(range(1, n+1)) - set(a), reverse=True)
    min_v = 0

    for i, x in enumerate(a):
        if min_v < x:
            min_v = x
            ans[i] = x
        elif min_v == x:
            if rem and rem[-1] < min_v:
                ans[i] = rem.pop()
            else:
                break
        else:
            break
    else:
        print(*ans)
        continue
    print(-1)


t=int(input())
for _ in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    mini=1
    ans=[]
    d=dict()
    co=0
    d2=dict()
    flag=0
    for i in range(len(l)):
        co+=1
        if(l[i]<i+1):
            flag=1
            break
        if(l[i]!=i+1):
            d[i+1]=1
        if l[i] in d2:
            ans+=[-1]

        else:
            ans+=[l[i]]
            d2[l[i]]=1
    if(flag==1):
        print(-1)
    else:
        temp=[]
        for i in d:
            temp+=[i]
        ind=0
        for i in range(n):
            if(ans[i]==-1):
                ans[i]=temp[ind]
                ind+=1

    #print(d)
        print(*ans)
    # ind=0
    # for i in range(n):
    #     if(d[i])


t=int(input())
for _ in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    mini=1
    ans=[]
    d=dict()
    co=0
    d2=dict()
    flag=0
    for i in range(len(l)):
        co+=1
        if(l[i]<i+1):
            flag=1
            break
        if(l[i]!=i+1):
            d[i+1]=1
        if l[i] in d2:
            ans+=[-1]

        else:
            ans+=[l[i]]
            d2[l[i]]=1
    if(flag==1):
        print(-1)
    else:
        temp=[]
        for i in d:
            temp+=[i]
        temp.sort()
        ind=0
        for i in range(n):
            if(ans[i]==-1):
                ans[i]=temp[ind]
                ind+=1

    #print(d)
        print(*ans)
    # ind=0
    # for i in range(n):
    #     if(d[i])


t=int(input())
for _ in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    mini=1
    ans=[]
    d=dict()
    co=0
    d2=dict()
    flag=0
    maxi=-1
    for i in range(len(l)):
        co+=1
        if(l[i]<i+1):
            flag=1
            break
        if(l[i]!=i+1):
            d[i+1]=1
        if l[i] in d2:
            ans+=[-1]

        else:
            ans+=[l[i]]
            d2[l[i]]=1
    deld=[]
    for i in d:
        if i in d2:
            deld+=[i]
    for i in deld:
        del d[i]
    if(flag==1):
        print(-1)
    else:
        temp=[]
        for i in d:
            temp+=[i]
        temp.sort()
        ind=0
        for i in range(n):
            if(ans[i]==-1 ):
                ans[i]=temp[ind]
                ind+=1
        print(*ans)


import sys
t = int(input())
for i in range(t):
    n = int(input())
    array = [int(s) for s in input().split()]
    flag = True
    for j in range(len(array)):
        if array[j] < j + 1:
            print(-1)
            flag = False
    if not flag:
        continue
    curr = 1
    used = set()
    ans = [array[0]]
    used.add(array[0])
    for j in range(1, len(array)):
        #print(used)
        if array[j] != array[j - 1]:
            ans.append(array[j])
            used.add(array[j])
        else:
            while curr <= n and curr in used:
                curr += 1
            ans.append(curr)
            used.add(curr)
    print(' '.join([str(s) for s in ans]))


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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            int  n = int.Parse(Console.ReadLine());
            string  ar = Console.ReadLine();
            Console.WriteLine(SolveProblem(n, ar));
            Console.ReadLine();
        }

        static string SolveProblem (int n, string record)
        {
            string  result;
            int a = 0;
            int d = 0;

            for (int i = 0; i < record.Length ;i++)
            {
                if (record[i] == 'A')
                {
                    a++;
                }else if (record[i] == 'D')
                {
                    d++;
                }
            }

            if (a > d)
            {
                result = "Anton";
            }else if (a < d)
            {
                result = "Danik";

            }
            else
            {
                result = "Friendship";
            }
            return result;
        }
        static string[] GetStrings() => (Console.ReadLine()).Split(' ');

        static int[] GetInts()
        {
            string[] s = (Console.ReadLine()).Split(' ');
            int[] integers = new int[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                integers[i] = int.Parse(s[i]);
            }
            return integers;
        }

        static double[] GetDoubles()
        {
            string[] s = (Console.ReadLine()).Split(' ');
            double[] doubles = new double[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                doubles[i] = double.Parse(s[i]);
            }
            return doubles;
        }
    }
}


using System;
using System.Collections.Generic;
namespace MY_Sheet
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int a = 0;
            int d = 0;

            n = int.Parse(Console.ReadLine());
            string name = Console.ReadLine();

            char[] charArr = name.ToCharArray();
            foreach (char ch in charArr)
            {
                if (ch == 'a' | ch == 'A')
                    a++;
                else
                    d++;
            }
            if(a>d)
                Console.WriteLine("Anton");
            else
                Console.WriteLine("Danik");
        }
    }
}


using System;
using System.Collections.Generic;
namespace MY_Sheet
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int a = 0;
            int d = 0;

            n = int.Parse(Console.ReadLine());
            string name = Console.ReadLine();

            char[] charArr = name.ToCharArray();
            foreach (char ch in charArr)
            {
                if (ch == 'a' | ch == 'A')
                    a++;
                else
                    d++;
            }
            if(a>d)
                Console.WriteLine("Anton");
            else if(d>a)
                Console.WriteLine("Danik");
            else
                Console.WriteLine("Friendship");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
namespace ogaver__
{

    class Program
    {
        static void Main(string[] args)
        {
            int n = Int(Console.ReadLine());
            var s = Console.ReadLine();

            int a = 0;
            for (int i = 0; i < n; i++)
                if (s[i] == 'A')
                    a++;

            int middle = s.Length / 2;
            if (s.Length % 2 != 0)
                middle++;

            if(a > middle)
            {
                Console.WriteLine("Anton");
            }
            else if(a < middle)
                Console.WriteLine("Danik");
            else
                Console.WriteLine("Friendship");

        }

        static int Int(object o)
        {
            return Convert.ToInt32(o);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
namespace ogaver__
{

    class Program
    {
        static void Main(string[] args)
        {
            int n = Int(Console.ReadLine());
            var s = Console.ReadLine();

            int a = 0;
            int b = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'A')
                    a++;
                else
                    b++;
            }

            if(a > b)
                Console.WriteLine("Anton");
            else if(a < b)
                Console.WriteLine("Danik");
            else
                Console.WriteLine("Friendship");

        }

        static int Int(object o)
        {
            return Convert.ToInt32(o);
        }
    }
}


            int x = Convert.ToInt32(Console.ReadLine());
            string name = Console.ReadLine().ToUpper();
            int sum =0, sum1 = 0;
            for(int i = 0; i<x; i++)
            {
                if(name[i]=='A')
                {
                    sum = sum + 1;
                }
                else if(name[i]=='D')
                {
                    sum1 = sum1 + 1;
                }
            }
            if (sum > sum1) Console.WriteLine("Anton");
            else if (sum < sum1) Console.WriteLine("Danik");
            else Console.WriteLine("FriendShip");


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

namespace ConsoleApp19
{
    class Program
    {
        static void Main(string[] args)
        {
            int Anton=0;
            int Danik=0;
            int n = Convert.ToInt32(Console.ReadLine());
            string ws = Console.ReadLine();
            for(int i =0; i <n; i++)
            {
                if (ws[i] == 'A') Anton += 1;
                else Danik += 1;
            }
            if (Anton > Danik) Console.WriteLine("Anton");
            else Console.WriteLine("Danik");
        }

    }
}


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

namespace habd
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = Convert.ToInt32(Console.ReadLine());

            string n = Console.ReadLine().ToUpper();
            char[] test = n.ToCharArray();
            List<char> a = new List<char>();
            List<char> b = new List<char>();
            for (int i=0; i<x; i++)
            {
                if(test[i] == 'A')
                {
                    a.Add(test[i]);
                }
                else
                {
                    b.Add(test[i]);
                }
            }
           if(a.Count>b.Count)
            {
                Console.WriteLine("Anton");
            }
            else if(a.Count == b.Count)
            {
                Console.WriteLine("Friendship");
            }
           else
            {
                Console.WriteLine("Danik");
            }
        }
    }
}


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

namespace ConsoleApp19
{
    class Program
    {
        static void Main(string[] args)
        {
            int Anton=0;
            int Danik=0;
            int n = Convert.ToInt32(Console.ReadLine());
            string ws = Console.ReadLine();
            for(int i =0; i <n; i++)
            {
                if (ws[i] == 'A') Anton += 1;
                else Danik += 1;
            }
            if (Anton > Danik) Console.WriteLine("Anton");
            else if (Anton == Danik) Console.WriteLine("Friendship");
            else Console.WriteLine("Danik");
        }

    }
}


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

namespace habd
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = Convert.ToInt32(Console.ReadLine());
            string name = Console.ReadLine().ToUpper();
            int sum =0, sum1 = 0;
            for(int i = 0; i<x; i++)
            {
                if(name[i]=='A')
                {
                    sum = sum + 1;
                }
                else if(name[i]=='D')
                {
                    sum1 = sum1 + 1;
                }
            }
            if (sum > sum1) Console.WriteLine("Anton");
            else if (sum < sum1) Console.WriteLine("Danik");
            else Console.WriteLine("Friendship");
        }
    }
}


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

namespace codeforces
{
    class Program
    {

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var matches = Console.ReadLine();

            var count = 0;

            foreach (var match in matches)
            {
                if (match == 'A') count++;
                else count--;
            }

            if (count == 0) Console.WriteLine("Friendship");
            else if (count < 0) Console.WriteLine("Danik");
            else Console.WriteLine("Anton");

        }
    }
}


 class Program
    {
        static void Main(string[] args)
        {

            int numberOfGames, aCount = 0,
                dCount = 0;
            string results = "";

            numberOfGames = Convert.ToInt32(Console.ReadLine());

            results = Console.ReadLine();

            for (int i = 0; i < results.Length; i++)
            {
                if (results[i] == 'A')
                {
                    aCount++;
                }
                else if (results[i] == 'D')
                {
                    dCount++;
                }
            }

            Console.WriteLine(aCount > dCount ? "Anton" : "Danik");

        }
    }


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

namespace Code_Forces
{
    class Program
    {
        static void Main(string[] args)
        {

            int numberOfGames, aCount = 0,
                dCount = 0;
            string results = "";

            numberOfGames = Convert.ToInt32(Console.ReadLine());

            results = Console.ReadLine();

            for (int i = 0; i < results.Length; i++)
            {
                if (results[i] == 'A')
                {
                    aCount++;
                }
                else if (results[i] == 'D')
                {
                    dCount++;
                }
            }

            Console.WriteLine(aCount > dCount ? "Anton" : "Danik");

        }
    }
}


static void Main(string[] args)
        {

            int numberOfGames, aCount = 0,
                dCount = 0;
            string results = "";

            numberOfGames = Convert.ToInt32(Console.ReadLine());

            results = Console.ReadLine();

            for (int i = 0; i < results.Length; i++)
            {
                if (results[i] == 'A')
                {
                    aCount++;
                }
                else if (results[i] == 'D')
                {
                    dCount++;
                }
            }

            Console.WriteLine(aCount > dCount ? "Anton" : "Danik");

        }


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

namespace Code_Forces
{
    class Program
    {
        static void Main(string[] args)
        {
            int numberOfGames, aCount = 0,
                dCount = 0;
            string results = "";

            numberOfGames = Convert.ToInt32(Console.ReadLine());

            results = Console.ReadLine();

            for (int i = 0; i < results.Length; i++)
            {
                if (results[i] == 'A')
                {
                    aCount++;
                }
                else if (results[i] == 'D')
                {
                    dCount++;
                }
            }

            if (aCount > dCount)
            {
                Console.WriteLine("Anton");
            }
            else if (dCount > aCount)
            {
                Console.WriteLine("Danik");
            }
            else
            {
                Console.WriteLine("Friendship");
            }

        }
    }
}


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

namespace CODING_C_SHARP
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            int countA = 0,countD = 0;
            for (int i = 0; i < str.Length; i++)
            {
                if (str[i] == 'A')
                {
                    countA++;
                }
                else if (str[i] == 'D')
                {
                    countD++;
                }
            }
            if (countA > countD)
            {
                Console.Write("Anton");
            }
            else if (countA < countD)
            {
                Console.Write("Danik");
            }
            else if (countA == countD)
            {
                Console.Write("Friendship");
            }
                Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;

namespace Anton_And_Danik
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            String names = Console.ReadLine();

            int countA = 0;
            int countD = 0;

            for (int i = 0; i < n; i++)
            {
                if (names[i] == 'A')
                {
                    countA++;
                }
                else
                {
                    countD++;
                }

            }

            if (countA > countD)
            {
                Console.WriteLine("Anton");
            }
            else if (countA < countD)
            {
                Console.WriteLine("Danik");
            }
            else if (countA == countD)
            {
                Console.WriteLine("Friendship");
            }

        }
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        public static void Main(string[] args)
        {
            var firstLine = Console.ReadLine();
            string secondLine = Console.ReadLine();
            int anton = 0;

            for(int i = 0; i < secondLine.Length;i++)
            {
                if (secondLine[i] == 'A')
                    anton++;

            }
            if (anton == secondLine.Length / 2)
                Console.WriteLine("Friendship");
            else if (anton > Math.Ceiling(secondLine.Length / 2.0))
                Console.WriteLine("Anton");
            else
                Console.WriteLine("Danik");

        }

    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        public static void Main(string[] args)
        {
            var firstLine = Console.ReadLine();
            string secondLine = Console.ReadLine();
            int anton = 0;

            for(int i = 0; i < secondLine.Length;i++)
            {
                if (secondLine[i] == 'A')
                    anton++;

            }

            if (anton >= Math.Ceiling(secondLine.Length / 2.0))
                Console.WriteLine("Anton");
            else
                Console.WriteLine("Danik");

        }

    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        public static void Main(string[] args)
        {
            var firstLine = Console.ReadLine();
            string secondLine = Console.ReadLine();
            int anton = 0;

            for(int i = 0; i < secondLine.Length;i++)
            {
                if (secondLine[i] == 'A')
                    anton++;

            }
            if (anton == secondLine.Length / 2 && secondLine.Length %2 == 0)
                Console.WriteLine("Friendship");
            else if (anton > Math.Ceiling(secondLine.Length / 2.0))
                Console.WriteLine("Anton");
            else
                Console.WriteLine("Danik");

        }

    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        public static void Main(string[] args)
        {
            var firstLine = Console.ReadLine();
            string secondLine = Console.ReadLine();
            int anton = 0;

            for(int i = 0; i < secondLine.Length;i++)
            {
                if (secondLine[i] == 'A')
                    anton++;

            }
            if (anton == secondLine.Length / 2 && secondLine.Length %2 == 0)
                Console.WriteLine("Friendship");
            else if (anton >= Math.Ceiling(secondLine.Length / 2.0))
                Console.WriteLine("Anton");
            else
                Console.WriteLine("Danik");

        }

    }
}


 class Program
    {
        static void Main(string[] args)
        {

            int length = Convert.ToInt32(Console.ReadLine());
            int D = 0  , A = 0;
            string str = Console.ReadLine();
            for (int i = 0; i < length; i++)
            {
                if (str[i] == 'A')
                {
                    A += 1;

                }

                if (str[i] == 'D')
                {
                    D += 1;

                }

            }

            if (A > D)
            {
                Console.WriteLine("Atone");

            }

            else
            {
                Console.WriteLine("Danik");

            }

        }
    }


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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {

            int length = Convert.ToInt32(Console.ReadLine());
            int D = 0  , A = 0;
            string str = Console.ReadLine();
            for (int i = 0; i < length; i++)
            {
                if (str[i] == 'A')
                {
                    A += 1;

                }

                if (str[i] == 'D')
                {
                    D += 1;

                }

            }

            if (A > D)
            {
                Console.WriteLine("Atone");

            }

            else if (D > A)
            {
                Console.WriteLine("Danik");

            }
            else {

                Console.WriteLine("Friendship");

            }

        }
    }
}


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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {

            int length = Convert.ToInt32(Console.ReadLine());
            int D = 0  , A = 0;
            string str = Console.ReadLine();
            for (int i = 0; i < length; i++)
            {
                if (str[i] == 'A')
                {
                    A += 1;

                }

                if (str[i] == 'D')
                {
                    D += 1;

                }

            }

            if (A > D)
            {
                Console.WriteLine("Anton");

            }

            else if (D > A)
            {
                Console.WriteLine("Danik");

            }
            else {

                Console.WriteLine("Friendship");

            }

        }
    }
}


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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {

            int length = Convert.ToInt32(Console.ReadLine());
            int D = 0  , A = 0;
            string str = Console.ReadLine();
            for (int i = 0; i < length; i++)
            {
                if (str[i] == 'A')
                {
                    A += 1;

                }

                if (str[i] == 'D')
                {
                    D += 1;

                }

            }

            if (A > D)
            {
                Console.WriteLine("Atone");

            }

            else
            {
                Console.WriteLine("Danik");

            }

        }
    }
}


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

namespace AntonAndDanik
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            str = Console.ReadLine();
            char[] arr = str.ToCharArray();
            int anton = 0;
            for (int i = 0; i < arr.Length; i++)
            {
                if (arr[i] == 'A')
                {
                    anton++;
                }
            }
            int danik = arr.Length - anton;
            if (anton>danik)
            {
                str = "Anton";
            }
            else if (anton<danik)
            {
                str = "Danik";
            }
            else
            {
                str = "Friendship";
            }
            Console.WriteLine(str);

        }

    }
}


using System;

namespace ProblemSolving_CF_A
{
    class AntonandDanik
    {
        static void Main(string[] args)
        {
            var gamesNumber = Console.ReadLine();
            var winInput = Console.ReadLine().ToUpper().Substring(0,gamesNumber);
            var antonGamesWin = winInput.Count(s => s.Equals('A'));
            var danikGamesWin = winInput.Count(s => s.Equals('D'));

            if (antonGamesWin==danikGamesWin)
            {
                Console.WriteLine("FriendShip");
                return;
            }
            Console.WriteLine("{0}",antonGamesWin>danikGamesWin?"Anton":"Danik");
        }
    }
}


using System;
namespace ProblemSolving_CF_A
{
    class Program
    {
        static void Main(string[] args)
        {
           var gamesNumber = Console.ReadLine();
            var winInput = Console.ReadLine().ToUpper().Substring(0,int.Parse(gamesNumber));
            var antonGamesWin = winInput.Count(s => s.Equals('A'));
            var danikGamesWin = winInput.Count(s => s.Equals('D'));

            if (antonGamesWin==danikGamesWin)
            {
                Console.WriteLine("FriendShip");
                return;
            }
            Console.WriteLine("{0}",antonGamesWin>danikGamesWin?"Anton":"Danik");
        }
    }


using System;
using System.Linq;

namespace ProblemSolving_CF_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int gamesNumber = Convert.ToInt32(Console.ReadLine());
            var winInput = Console.ReadLine().ToUpper().Substring(0,gamesNumber);
            var antonGamesWin = winInput.Count(s => s.Equals('A'));
            var danikGamesWin = winInput.Count(s => s.Equals('D'));

            if (antonGamesWin==danikGamesWin)
            {
                Console.WriteLine("FriendShip");
                return;
            }
            Console.WriteLine("{0}",antonGamesWin>danikGamesWin?"Anton":"Danik");
        }
    }
}


using System;
using System.Linq;

namespace ProblemSolving_CF_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int gamesNumber = Convert.ToInt32(Console.ReadLine());
            var winInput = Console.ReadLine().ToUpper().Substring(0,gamesNumber);
            var antonGamesWin = winInput.Count(s => s.Equals('A'));
            var danikGamesWin = winInput.Count(s => s.Equals('D'));
            Console.WriteLine("{0}",antonGamesWin==danikGamesWin ?"Friendship": antonGamesWin>danikGamesWin? "Anton" : "Danik");
        }
    }
}


using System;
using System.Linq;

namespace ProblemSolving_CF_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int gamesNumber = Convert.ToInt32(Console.ReadLine());
            var winInput = Console.ReadLine().ToUpper().Substring(0,gamesNumber);
            var antonGamesWin = winInput.Count(s => s.Equals('A'));
            var danikGamesWin = winInput.Count(s => s.Equals('D'));
            Console.WriteLine("{0}",antonGamesWin==danikGamesWin ?"FriendShip": antonGamesWin>danikGamesWin? "Anton" : "Danik");
        }
    }
}


using System;
using System.Linq;

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string res = Console.ReadLine();
			int a = 0, d = 0;
			for (int i = 0; i < n; i++)
			{
				if (res[i] == 'A') a++;
				else d++;
			}
			if (a == d) Console.WriteLine("Friendship");
			else Console.WriteLine(a > d ? "Anton" : "Danik");
			Console.ReadLine();
		}
	}
}


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

namespace CodeForcesExercises
{
    class Program
    {
        static void Main(string[] args)
        {
            var loops = Convert.ToInt32(Console.ReadLine());
            var input = Console.ReadLine().ToCharArray();

            var anton = 0;
            var danik = 0;

            for(var x = 0; x < loops; x++)
            {
                switch (input[x])
                {
                    case 'A':
                        anton++;
                        break;
                    case 'D':
                        danik++;
                        break;
                }
            }

            if(anton > danik)
            {
                Console.WriteLine("Anton");
            }
            else
            {
                Console.WriteLine("Danik");
            }
        }
    }
}


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

namespace CodeForcesExercises
{
    class Program
    {
        static void Main(string[] args)
        {
            var loops = Convert.ToInt32(Console.ReadLine());
            var input = Console.ReadLine().ToCharArray();

            var anton = 0;
            var danik = 0;

            for(var x = 0; x < loops; x++)
            {
                switch (input[x])
                {
                    case 'A':
                        anton++;
                        break;
                    case 'D':
                        danik++;
                        break;
                }
            }

            if(anton > danik)
            {
                Console.WriteLine("Anton");
            }
            else if(danik > anton)
            {
                Console.WriteLine("Danik");
            }
            else
            {
                Console.WriteLine("Friendship");
            }
        }
    }
}


using System;

public class Program
{
    static void Main()
    {
        int antonWins = 0, danikWins = 0, n = int.Parse(Console.ReadLine());

        string winners = Console.ReadLine();

        for (int i = 0; i < n; ++i)
            if (winners[i] == 'A')
                antonWins++;
            else
                danikWins++;

        if (antonWins > danikWins)
            Console.WriteLine("Anton");
        else if (danikWins> antonWins)
            Console.WriteLine("Danik");
        else
            Console.WriteLine("Friendship");
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
  class Program
    {

        public static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        public static void ReadIntPair(out int a, out int b)
        {
            var ar = ReadIntArray();
            a = ar[0];
            b = ar[1];
        }
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

static void Main(string[] args){

            var n=ReadInt();
            var str = Console.ReadLine();
            int cnt1=0;
            int cnt2=0;
            for(int i=0;i<str.Length;i++){
                if(str[i]=='A' ){
                    cnt1++;
                }
                if(str[i]=='D'){
                    cnt2++;
                }
            }
            if(cnt2>cnt1){
                Console.WriteLine("Danik");
            }else if(cnt1>cnt2){
                Console.WriteLine("Anton");

            }else{
                Console.WriteLine("Friendship");
            }

    }}


using System;

class Program
{
    static void Main(string[] args)
    {

        var gamesPlayed = Convert.ToInt32(Console.ReadLine());
        var gamesOutput = Console.ReadLine();
        var antonWon = 0;
        var danikWon = 0;
        foreach (var game in gamesOutput)
        {
            if (game == 'A') antonWon++;
            if (game == 'D') danikWon++;
        }

        if (antonWon > danikWon) Console.WriteLine("Anton");
        else if (antonWon < danikWon) Console.WriteLine("Danik");
        else Console.WriteLine("FriendShip");
    }

}


using System;

class Program
{
    static void Main(string[] args)
    {

        var gamesPlayed = Convert.ToInt32(Console.ReadLine());
        var gamesOutput = Console.ReadLine();
        var antonWon = 0;
        var danikWon = 0;
        foreach (var game in gamesOutput)
        {
            if (game == 'A') antonWon++;
            if (game == 'D') danikWon++;
        }

        if (antonWon > danikWon) Console.WriteLine("Anton");
        else if (antonWon < danikWon) Console.WriteLine("Danik");
        else Console.WriteLine("Friendship");
    }

}


using System;
using System.Collections.Generic;

using System.Linq;

namespace Probs
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string games = Console.ReadLine();

            int anton = 0;
            int danik = 0;
            for (int i = 0; i < games.Length; i++)
            {
                if (games[i] == 'A') anton++;
                else danik++;
            }

            if (anton == danik) Console.WriteLine("Friendship");
            else if (anton > danik) Console.WriteLine("Anton");
            else Console.WriteLine("Danik");
        }
    }

}


using System;

class Sample{
	public static void Main() {
		int n=int.Parse(Console.ReadLine());
		var str=Console.ReadLine();
		int a=0,d=0;
		for(int i=0;i<n;i++)
		{
		    if(str[i]=='A')
		    {
		        a+=1;
		    }
		    else
		    {
		        d+=1;
		    }
		}
		if(a==d)
		{
		    Console.WriteLine("Friendship");
		}
		else if(a>d)
		{
		    Console.WriteLine("Anton");
		}
		else
		{
		    Console.WriteLine("Danik");
		}
	}
}


using System;

namespace Problems
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            String str = Console.ReadLine().Trim();

            int a  = 0, d = 0;
            for(int i = 0; i < str.Length; i++)
            {
                if (str[i] == 'A')
                    a++;
                else
                    d++;
            }
            if (a > d)
                Console.WriteLine("Anton");
            else if (d > a)
                Console.WriteLine("Danik");
            else
                Console.WriteLine("Friendship");
        }

    }
}


using System;
using System.Linq;
namespace Problems
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            String str = Console.ReadLine().Trim();
            int a  = str.Count(c => c == 'A'),
                d = str.Count( c => c == 'D');

            if (a > d)
                Console.WriteLine("Anton");
            else if (d > a)
                Console.WriteLine("Danik");
            else
                Console.WriteLine("Friendship");
        }

    }
}


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
            int a = 0, d = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'A')
                    a++;
                else d++;
            }
            if (a > d)
                Console.Write("Anton");
            else if (d > a)
                Console.Write("Danik");
            else Console.Write("Friendship");
        }
    }


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
            int a = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'A')
                    a++;
            }
            if (a > n/2)
                Console.Write("Anton");
            else if (n/2 == a)
                Console.Write("Friendship");
            else Console.Write("Danik");
        }
    }
}


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
            int a = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'A')
                    a++;
            }
            if (a > n/2)
                Console.Write("Anton");
            else if (n/2 > a)
                Console.Write("Danik");
            else Console.Write("Friendship");
        }
    }
}


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
            int a = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'A')
                    a++;
            }
            if (a > n/2)
                Console.Write("Anton");
            else if (n/2+1 > a)
                Console.Write("Danik");
            else Console.Write("Friendship");
        }
    }
}


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
            int a = 0, d = 0;
            for (int i = 0; i < n; i++)
            {
                if (s[i] == 'A')
                    a++;
                else d++;
            }
            if (a > d)
                Console.Write("Anton");
            else if (d > a)
                Console.Write("Danik");
            else Console.Write("Friendship");
        }
    }
}


using System;
using System.Linq;

namespace CodeForcecTrain
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string input = Console.ReadLine();
            var countD = input.Where(x => x == 'D').Count();
            var countA = input.Where(x => x == 'A').Count();
            if (countA > countD)
            {
                Console.Write("Anton");
            }
            else if (countA < countD)
            {
                Console.Write("Danik");
            }
            else
            {
                Console.Write("Friendship");
            }
        }
    }
}


using System;
using System.Linq;

namespace CodeForcecTrain
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            var countD = input.Where(x => x == 'D').Count();
            var countA = input.Where(x => x == 'A').Count();
            if (countA>countD)
            {
                Console.Write("Anton");
            }
            else if (countA < countD)
            {
                Console.Write("Danik");
            }
            else
            {
                Console.Write("Friendship")
            }
        }
    }
}


using System;
using System.Linq;

namespace CodeForcecTrain
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            var countD = input.Where(x => x == 'D').Count();
            var countA = input.Where(x => x == 'A').Count();
            if (countA>countD)
            {
                Console.Write("Anton");
            }
            else if (countA < countD)
            {
                Console.Write("Danik");
            }
            else
            {
                Console.Write("Friendship");
            }
        }
    }
}


using System;
using System.Linq;

namespace A._Anton_and_Danik
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string line = Console.ReadLine();
            long numberOFA = 0, numberOFB = 0;

            for (int i = 0; i < line.Length; i++)
            {
                if (line[i] == 'A') numberOFA++;
                else numberOFB++;
            }
            if (numberOFA > numberOFB) Console.WriteLine("Anton");
            else if (numberOFA > numberOFB) Console.WriteLine("Danik");
            else Console.WriteLine("Friendship");
        }
    }
}


using System;
using System.Linq;

namespace A._Anton_and_Danik
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string line = Console.ReadLine();
            long numberOFA = 0, numberOFB = 0;

            for (int i = 0; i < line.Length; i++)
            {
                if (line[i] == 'A') numberOFA++;
                else numberOFB++;
            }
            if (numberOFA > numberOFB) Console.WriteLine("Anton");
            else if (numberOFA < numberOFB) Console.WriteLine("Danik");
            else Console.WriteLine("Friendship");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;

namespace cnetframework
{
    class Program
    {
        static void Main(string[] args)
        {
            int n,Anton=0,Danik=0;
            n = Convert.ToInt32(Console.ReadLine());
            string games;
            games = Console.ReadLine();
            for (int i = 0; i < n; i++)
                if (games[i] == 'A')
                    Anton++;
                else
                    Danik++;
            if (Anton > Danik)
                Console.WriteLine("Anton");
            else
                if (Anton == Danik)
                Console.WriteLine("Friendship");
            else
                Console.WriteLine("Danik");
        }
    }
}


using System;

namespace _4A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var str = Console.ReadLine();
            var danik = str.Replace("A", "").Length * 2;

            string result;
            if (danik > str.Length) result = "Danik";
            else if (danik < str.Length) result = "Anton";
            else result = "Friendship";

            Console.WriteLine(result);
        }
    }
}


using System;

namespace _4A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var danik = Console.ReadLine().Replace("A", "").Length * 2;

            string result;
            if (danik > n) result = "Danik";
            else if (danik < n) result = "Anton";
            else result = "Friendship";

            Console.WriteLine(result);
        }
    }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            string games = Console.ReadLine();
            string Results = Console.ReadLine();
            int A = Results.Where(x => x == 'A').ToList().Count();
            int D = Results.Where(x => x == 'D').ToList().Count();

            if (A > D) { Console.WriteLine("Anton"); }
            else if (A < D) { Console.WriteLine("Danik"); }
            else { Console.WriteLine("Friendship"); }

        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n1 = Convert.ToInt32(Console.ReadLine());
            string input = Console.ReadLine();
            int a = 0;
            int d = 0;

            for (int i = 0; i < n1; i++)
            {
                if (input[i] == 'A')
                    a++;
                else
                    d++;
            }

            string output = string.Empty;

            if (a == d)
                output = "Friendship";
            else if (a > d)
                output = "Anton";
            else
                output = "Danik";
            Console.WriteLine(output);
        }
    }
}


using System;

namespace Anton_and_Danik
{
    class Program
    {
        static void Main(string[] args)
        {
            float n = float.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToCharArray();
            int a = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A')
                    a++;
            }
            Console.WriteLine(n/2-a == 0 ? "Friendship" : (a>n-a ? "Anton" : "Danik"));
        }
    }
}


using System;

namespace Anton_and_Danik_0
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int a = 0;
            while (n > 0)
            {
                a += Console.Read() == 'A' ? +1 : -1;
                n--;
            }
            Console.WriteLine(a == 0 ? "Friendship" : (a > 0 ? "Anton" : "Danik"));
            Console.ReadKey();
        }
    }
}


using System;

namespace Anton_and_Danik
{
    class Program
    {
        static void Main(string[] args)
        {
            float n = float.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToCharArray();
            int a = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A')
                    a++;
            }
            Console.WriteLine("a = " + a);
            Console.WriteLine(n/2-a == 0 ? "Friendship" : (a>n-a ? "Anton" : "Danik"));
            Console.ReadKey();
        }
    }
}


using System;

namespace Anton_and_Danik
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToCharArray();
            int a = 0, d = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A')
                    a++;
                else
                    d++;
            }
            if (a > d)
                 Console.WriteLine("Anton");
            else if (d > a)
                 Console.WriteLine("Danik");
                 else
                 Console.WriteLine("Friendship");
        }
    }
}


using System;

namespace Anton_and_Danik_0
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int a = 0;
            while (n > 0)
            {
                a += Console.Read() == 65 ? +1 : -1;
                n--;
            }
            Console.WriteLine(a == 0 ? "Friendship" : (a > 0 ? "Anton" : "Danik"));
            Console.ReadKey();
        }
    }
}


using System;

namespace Anton_and_Danik_1
{
    class Program
    {
        static void Main(string[] args)
        {
            float a = float.Parse(Console.ReadLine()) / 2 - Console.ReadLine().Replace("A", "").Length;
            Console.WriteLine(a == 0 ? "Friendship" : (a > 0 ? "Anton" : "Danik"));
        }
    }
}


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

namespace _734A
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string str = Console.ReadLine();
            int a = 0, d = 0;
            for (int i = 0; i < str.Length; i++)
            {
                if (str[i] == 'A') { a++; } else { d++; }
            }
            if (a > d) { Console.WriteLine("Anton"); } else
            if (a < d) { Console.WriteLine("Danik"); }
            else { Console.WriteLine("Friendship"); }

        }
    }
}


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

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = Int();
			var s = Console.ReadLine();
			var a = 0;
			var d = 0;
			for (int i = 0; i < n; i++)
			{
				if (s[i] == 'A')
					a++;
				else
					d++;
			}
			if (a > d)
			{
				Console.WriteLine("Anton");
			}
			else if (d > a)
				Console.WriteLine("Danik");
			else
				Console.WriteLine("Friendship");
		}

		static int Int()
		{
			return Int32.Parse(Console.ReadLine());
		}

		static (int, int) Int2()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
			return (arr[0], arr[1]);
		}

		static (int, int, int) Int3()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
			return (arr[0], arr[1], arr[2]);
		}

		static int[] Ints()
		{
			return Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
		}

	}

}


using System;

namespace _734a
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int a = 0, b = 0;
            for (int i = 0; i < n; ++i)
                if (s[i] == 'A') ++a;
                else ++b;
            Console.WriteLine(a > b ? "Anton" : (a < b ? "Danik" : "Friendship"));
        }
    }
}


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

namespace Programming_Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 0, d = 0;
            int l = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            char[] cstr = str.ToCharArray();
            for(int i = 0; i < l; i++)
            {
                if (cstr[i] == 'A')
                {
                    a++;
                }
                else if (cstr[i] == 'D')
                {
                    d++;
                }
            }
            if (a > d)
            {
                Console.WriteLine("Anton");
            }
            else if (a < d)
            {
                Console.WriteLine("Danik");
            }
            else
            {
                Console.WriteLine("Friendship");
            }
        }
    }
}


fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("INPUT::read line failed");
    let amount = input.trim().parse::<i32>().expect("AMOUNT::parse to i32 failed");

    let mut rows = String::new();
    std::io::stdin().read_line(&mut rows).expect("ROWS::read line failed");

    let (mut anton_win, mut danik_win) = (i32::default(), i32::default());

    for _i in 0..rows.len() {
        match rows.pop().unwrap() {
            'A' => anton_win += 1,
            'D' => danik_win += 1,
            _ => (),
        }
    }
    //println!("anton_win = {}\r\ndanik_win = {}\r\n", anton_win, danik_win);
    if anton_win > danik_win {
        println!("Anton");
    }else if anton_win == danik_win {
        println!("Friendship");
    }else {
        println!("Danik");
    }

}