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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

const readLine=()=> inputString[currentLine++];
/* ================================================
           Main Solution Starts Here
===================================================*/

const main=()=>{
	let x = parseInt(readLine())
	let chances=readLine()
	let a=0,d=0

	for(let chance of chances){
		if(chance=='A')
			a++
		else d++
	}

	if(a>d)
		console.log('Anton')
	else if(d>a)
		console.log('Danik')
	else console.log('Friendship')
}

var h = Math.floor(+readline() / 2);
var	s = readline();

var res = 0;
for (var i = 0, len = s.length; i < len && Math.abs(res) <= h; ++i) {
	s[i] == "A" ? res++ : res--;
}

if (res == 0) {
	print("Friendship");
} else if (res > 0) {
	print("Anton");
} else {
	print("Danik");
}

var count = readline();
var input = readline();

var Danik = input.replace(/A/g, '');

if(input.length / 2 > Danik.length)
    print("Anton");
else if(input.length / 2 === Danik.length)
    print("Friendship");
else
    print("Danik");

'use strict';

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var main = function main() {
  var read = function read() {
    return readline().split(' ');
  };
  var readints = function readints() {
    return read().map(parseInt);
  };

  var _readints = readints(),
      _readints2 = _slicedToArray(_readints, 1),
      n = _readints2[0];

  var s = readline();

  var count = function count(s, p) {
    return s.split(p).length - 1;
  };

  var A = count(s, 'A');
  var D = count(s, 'D');

  if (A > D) {
    print('Anton');
  } else if (A < D) {
    print('Danik');
  } else {
    print('Friendship');
  }
};

main();

var ss = readline();
var a = readline(); var c = 0;
for (var i = 0; i < a.length; i++) { if(a[i] == 'A') c++; }
if (c == a.length / 2) {
  print('Friendship');
} else {
	print (c > a.length / 2 ? 'Anton' : 'Danik');
}

  n = readline();
  m = readline();
  var A = 0;
  var D = 0;
  for(var i = 0; i < n; i++)
  {
    m[i] == "A" ? A++ : D++;
  }
  if(A > D)
  {
    print("Anton");
  }
  else if (D > A)
  {
    print("Danik");
  }
  else{
    print("Friendship");
  }

var n = readline();
var s = readline();

var numA = s.match(/A/g)?s.match(/A/g).length:0;
var numD = s.match(/D/g)?s.match(/D/g).length:0;

if(numA == numD)
	print('Friendship');
else if(numA > numD)
	print('Anton');
else
	print('Danik');

var n = readline();
var s = readline();
var numA=0,
	numD=0;

for(var i=0;i<s.length;i++)
{
	if(s[i]=='A')
		numA++;
	else
		numD++;
}

if(numA>numD)
	print('Anton');
else if(numA<numD)
	print('Danik');
else
	print('Friendship');

const main = () => {
    const n = Number.parseInt(readline());
    const s = readline();
    var balance = 0;
    for (var i = 0; i < n; i++) {
        balance += (s[i] == 'A') ? 1 : -1;
    }
    if (balance > 0)
        return 'Anton';
    else if (balance < 0)
        return 'Danik';
    else
        return 'Friendship';
};

write(main());

var n = parseInt(readline(), 10),
    s = readline().split(''),
    A = 0,
    D = 0;

for(var el of s) {
    el === 'A' ? A++ : D++;
}

print(A === D ? 'Friendship' : A > D ? 'Anton' : 'Danik');

(function main() {
	var n = readline();
	var line = readline();
	var len = parseInt(n);
	var aCon = 0;
	var dCon = 0;
	var c = 0;
	for (var i = 0; i < len; i++) {
		if (line[i] === "A") {
			aCon += 1;
		} else {
			dCon += 1;
		}
	}

		//print('aCon: ' + aCon + ' ,dCon: ' + dCon);

	if (aCon > dCon) {
		print('Anton');
	} else if (aCon === dCon) {
		print('Friendship');
	} else {
		print('Danik');
	}
	c++;

})();

var v1 = readline();
var v2 = readline();
var a = 0;
var i = 0;

while(i< v1 && a<= v1/2){
  if(v2[i] == 'A'){
    a++;
  }
  i++;
}

var result = a > v1/2 ? 'Anton' : (a < v1/2 ? 'Danik' : 'Friendship');
print(result);

var a = readline(), b = readline(), c = 0;

for (; a; a--) b[a - 1] === 'A' ? c++ : c--;
print(c > 0 ? 'Anton' : c < 0 ? 'Danik' : 'Friendship');

'use strict'
let a = readline(), b = readline(), c = 0;

for (; a; a--) b[a - 1] === 'A' ? c++ : c--;
print(c > 0 ? 'Anton' : c < 0 ? 'Danik' : 'Friendship');

var a = readline(), b = readline(), c = d = 0;

for (; a; a--) {
  if (b[a - 1] === "A") c++;
	else d++;
}

print(c > d ? 'Anton' : c < d ? 'Danik' : 'Friendship');

'use strict'
readline();
let a, b = 0;
for (a of [...readline()]) a === 'A' ? b++ : b--;
print(b > 0 ? 'Anton' : b < 0 ? 'Danik' : 'Friendship');

readline();
var a, b = 0;
for (a of [...readline()]) a === 'A' ? b++ : b--;
print(b > 0 ? 'Anton' : b < 0 ? 'Danik' : 'Friendship');

var a = readline(), b = readline(), c = d = 0;

for (; a; a--) b[a - 1] === 'A' ? c++ : d++;
print(c > d ? 'Anton' : c < d ? 'Danik' : 'Friendship');

function main(){
    var n = readline();
    var arr = readline();
    var a  = 0;
    var d = 0;
    for (var i = 0; i < arr.length; i++) {
        if(arr[i] == 'A') a +=1;
        else d +=1;
    }
    if(a == d) print("Friendship");
    else if(a > d) print('Anton');
    else print('Danik');
}
main();

var s = readline();
s= readline();
var a=0, d=0;
for(var i=0; i< s.length; i++){
    a += (s[i]==='A');
    d += (s[i]==='D');
}
print(a > d ? "Anton" : d > a ? "Danik" : "Friendship");

(function main(){
  //http://codeforces.com/problemset/problem/734/A
  var jugados = readline();
  var datos = readline();

  var anton = 0;
  var danik = 0;

  for (var i = 0; i < jugados; i++) {
    if(datos[i] == "A"){
      anton++;
    }else{
      danik++;
    }
  }
  var salida;
  if(anton>danik){
    salida = 'Anton';
  }else if(anton<danik){
    salida = 'Danik';
  }else{
    salida = 'Friendship';
  }
  print(salida)
})();

var n = readline();
var s = readline();

var no_of_A_wins = 0;
var no_of_D_wins = 0;

for(var i =0; i <= s.length - 1; i++){
    if(s[i] == "A"){
        no_of_A_wins = no_of_A_wins + 1;
    } else {
        no_of_D_wins = no_of_D_wins + 1;
    }
}

if(no_of_A_wins > no_of_D_wins){
    write("Anton");
} else if (no_of_A_wins < no_of_D_wins) {
    write("Danik");
} else {
    write("Friendship");
}

n = Number(readline());
a = [].reduce.call(readline(), (res, i) => res - (i === 'D'), n/2);
print(a > 0 ? 'Anton' : a < 0 ? 'Danik' : 'Friendship')

readline();print((function(x){return x > 0 ? 'Danik' : x < 0 ? 'Anton' : 'Friendship'})([].reduce.call(readline(), (res, i) => i === 'D' ? res + 1 : res - 1, 0)))

var A=0;
var D=0;
var n = parseInt(readline());
var input =readline();
for(var i=0;i<input.length;i++){
    if(input.charAt(i)=='A')
        A++;
    else
        D++;
}

if(A>D)
    print('Anton');
else if(D>A)
    print('Danik');
else
    print('Friendship');

n = Number(readline());
x = readline().replace(/A/g,"");
print(["Anton",["Friendship","Danik"][Number(x.length!=(n/2))]][Number(x.length>=(n/2))])

function main(){
    var n = +readline();
    var arr = readline().split('');
    var A = 0;
    var D = 0;
    for(var i = 0; i < n; ++i){
        if(arr[i] === 'A') ++A;
        else ++D;
    }
    if(A < D) {
        print('Danik');
        return;
    }
    if(A > D){
        print('Anton');
        return;
    }
    print('Friendship');
}

main();

const readline = require("readline");

let inputs = [];

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

rl.on("line", line => inputs.push(line));

rl.on("close", () => console.log(solution(inputs)));

function solution(data) {
    const [_, games] = data;
    const won = Math.floor(games.length / 2) + 1;
    const anton = games.split("").filter(x => x === "A");
    let ans;
    if (anton.length >= won) {
        ans = "Anton";
    } else if (games.length - anton.length >= won) {
        ans = "Danik";
    } else {
        ans = "Friendship";
    };
	return ans;
};

const readline = require("readline");

let inputs = [];

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

rl.on("line", line => inputs.push(line));

rl.on("close", () => console.log(solution(inputs)));

function solution(data) {
    const [_, games] = data;
    //const won = Math.floor(games.length / 2) + 1;
    //const anton = games.split("").filter(x => x === "A");
    //let ans;
    //if (anton.length >= won) {
    //    ans = "Anton";
    //} //else if (games.length - anton.length >= won) {
    //    ans = "Danik";
    //} else {
    //    ans = "Friendship";
    //};
	//return ans;

    const score = {
        A: 0,
        D: 0
    }
    games.split("").forEach(x => score[x]++);
    if (score.A > score.D) {
        ans = "Anton";
    } else if (score.D > score.A) {
        ans = "Danik";
    } else {
        ans = "Friendship";
    };
    return ans;
};

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

rl.on('line', input => {
    if (!/\d+/.test(input)) {
        let len = input.split('').filter(c => c == 'A').length
        if (len > input.length / 2)
            console.log('Anton')
        else if (len < input.length / 2)
            console.log('Danik')
        else
            console.log('Friendship')
        rl.close()
    }
})

var n = parseInt(readline());
	var s = readline().split("");
	var len = s.length;
	var ans = 0;
	for(var i = 0; i < len; i++)
	{
		if(s[i] == 'A')
			ans ++;
	}
	var flag;
	if(ans > len-ans)
	{
		flag = "Anton";
	}
	else if(ans < len-ans)
	{
		flag = "Danik";
	}
	else flag = "Friendship";
	print(flag);

const readline = require('readline');

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

let length;

rl.on('line', n => {
  if (!length) { length = n; } else {
    n = n.split('');
    const aCount = (n.filter(letter => letter === 'A')).length;
    const dCount = (n.filter(letter => letter === 'D')).length;
    const winner = aCount > dCount ? 'Anton' : aCount < dCount ? 'Danik' : 'Friendship';
    console.log(winner);
    rl.close();
  }
});

var num_games = parseInt(readline());
var results = readline().split("");
var A = 0;
var D = 0;
for(var i =0; i< num_games; i++){
    if(results[i]=='A') A++;
    if(results[i]=='D') D++;
}
if(A > D)print("Anton");
else if(D > A)print("Danik");
else print('Friendship');

var games = +readline();
var sequence = readline();
AntonWinnings = sequence.split('').reduce(function(wins, letter){
	return wins + (letter == 'A'?1:0);
}, 0);

if((games - AntonWinnings) > AntonWinnings){
	print('Danik');
}else if((games - AntonWinnings) < AntonWinnings){
	print('Anton')
}
else{
	print('Friendship');
}

var res = sol(readline(), readline());
print(res);

function sol(line, log) {
    var input = line.split(" ");
    var logs = log.split(" ");

    var n = input[0];
    var history = logs[0];

    var anton = 0;
    var denik = 0;

    while(n > 0){
        if(history[n - 1] == "A"){
            anton++;
        }else{
            denik++;
        }
        n--;
    }

    var winner = "";
    if(anton > denik){
        winner = "Anton";
    }else if(anton < denik){
        winner = "Danik";
    }else{
        winner = "Friendship";
    }

    return winner;
}

'use strict';

let inputBuffer = "", curLine = 0;

function readline() {
	return inputBuffer[curLine++];
}

let curTokens = [], curToken = 0;

function next() {
	while (curToken >= curTokens.length) {
		curTokens = readline().split(/[\s]+/);
		curToken = 0;
	}
	return curTokens[curToken++];
}

function nextInt () {
	return parseInt(next(), 10);
}

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

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

process.stdin.on('end', () => {
	inputBuffer = inputBuffer.trim().split('\n').map(line => line.trim());
	main();
});

function print(data) {
	process.stdout.write(data + "\n");
}

function main () {
	let n = nextInt();
	let s = next();
	let a = 0, d = 0;

	for(let i = 0; i < n; i++) {
		if(s[i] === 'A') a++;
		if (s[i] === 'D') d++;
	}

	if (a === d) print('Friendship');
	if (a > d) print('Anton');
	if (a < d) print('Danik');
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    const n = parseInt(readline()), line2 = readline()
    let d = 0, a =0;
    for (var i = 0 ; i < n;i++){
        (line2[i] === 'A') ? a ++ : d ++ ;
    }
    let result = 'Friendship';
    if (a > d) result = "Anton"
    else if (d > a) result = "Danik"

    console.log(result)
}

var n = parseInt(readline());
var res=readline().split('');
var A=0,D=0;
    for(i=0;i<n;i++){
    if(res[i]=='A')
        A++;
    else
        D++;
    }
    if(A>D)
      print("Anton");
    else if(D>A)
      print("Danik");
    else
      print("Friendship");

var print = this.print || require('lol-io').print
var write = this.write || require('lol-io').write
var readline = this.readline || require('lol-io').readline

var n=parseInt(readline());
var str=readline();
var anton=0;
var danik=0;
for(var i=0;i<n;i++){
    if(str[i]=='A')
    anton++;
    if(str[i]=='D')
    danik++;
}
if(anton==danik){
    print('Friendship')
}else if(anton>danik){
    print('Anton')
}else{
    print('Danik')
}

var all, lines, mainAux, print, readline, rl, rli, sum, who, write;

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

print = console.log;

write = function(...args) {
  return process.stdout.write(args.join(' '));
};

lines = [];

rl.on('line', function(line) {
  return lines.push(line);
});

rl.on('close', main);

rli = 0;

readline = function() {
  return lines[rli++];
};

sum = function(items) {
  return items.reduce(function(a, b) {
    return a + b;
  });
};

all = function(items) {
  var i, item, len;
  for (i = 0, len = items.length; i < len; i++) {
    item = items[i];
    if (!item) {
      return false;
    }
  }
  return true;
};

who = function(n, gs) {
  var asum, g;
  asum = sum((function() {
    var i, len, results;
    results = [];
    for (i = 0, len = gs.length; i < len; i++) {
      g = gs[i];
      if (g === 'A') {
        results.push(1);
      } else {
        results.push(0);
      }
    }
    return results;
  })());
  if (asum > n - asum) {
    return print('Anton');
  } else if (asum < n - asum) {
    return print('Danik');
  } else {
    return print('Friendship');
  }
};

mainAux = function() {
  var g, n;
  n = parseInt(readline());
  g = readline();
  return who(n, g);
};

  function main() {
    return mainAux();
  }
;

var numberMatch = +readline();
var secuenceWins = readline();
var Anton = 0;
for (var match=0; match<numberMatch; match++) {
    secuenceWins[match]==="A" ? Anton++ : "";
}
if (numberMatch-Anton>Anton) {
    print("Danik");
} else if (numberMatch-Anton<Anton) {
    print("Anton");
} else {
    print("Friendship");
}

var games = parseInt(readline());
var winners = readline().split("");

var obj = {
    'A': 0,
    'D': 0
}

for (var i = 0; i < games; i++ ) {
    if (winners[i] === 'A') {
        obj['A']++;
    } else if (winners[i] === 'D') {
        obj['D']++;
    }
}

if (obj['A'] === obj['D']) {
   print('Friendship');
} else if (obj['A'] > obj['D']) {
   print('Anton');
} else {
   print('Danik')
}

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

let input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
    const partii = parseInt(input[0], 10)
    const games = input[1]
    let result = ''
    if (partii > 1) {
        let anton = games.match(/(A)/g)
        if (anton) {
            anton = anton.length
        } else {
            anton = 0
        }
        result = anton > (partii / 2) ? 'Anton' : ( anton === (partii / 2) ? 'Friendship' : 'Danik')
    } else {
        result = games === 'A' ? 'Anton' : ( games === 'D' ? 'Danik' : 'Friendship')
    }
    console.log(result)
})

var n = readline();
var str = readline().split("");

var cnt = {'A': 0, 'D': 0};
for(var s of str)
	cnt[s]++;

if(cnt['A'] > cnt['D'])
	print("Anton");
else if(cnt['A'] < cnt['D'])
	print("Danik");
else
	print("Friendship")

let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  const n = Number(readLine());
  const s = readLine().split('');
  const c = s.reduce((acc, cur) => acc + (cur === 'D' ? 1 : 0), 0);
  if (c === s.length / 2) {
    console.log('Friendship')
  } else if (c > s.length / 2) {
    console.log('Danik')
  } else {
    console.log('Anton')
  }
}

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

rl.on('line', (d) => {
  if (counter === 0) {
    counter++;
    return;
  }

  let aCount = 0;
  let dCount = 0;

  for (let i = 0 ; i < d.length; i++) {
    if (d[i] === 'A') {
      aCount++;
    }
    else {
      dCount++;
    }
  }

  if (aCount > dCount) {
    console.log('Anton');
  }
  else if (dCount > aCount) {
    console.log('Danik');
  }
  else {
    console.log('Friendship');
  }

  counter++;
});

var inputLength = readline();
var matchResults = readline().split("");
var anton = 0;
var danik = 0;
matchResults.forEach(result => {
    if(result === 'A') anton++;
    else danik++;
});
if(anton > danik) print('Anton');
else if(anton < danik) print('Danik');
else print('Friendship');

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

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  const s = input[1];
  let d = 0, a = 0;
  for (let i = 0; i < s.length; i += 1) {
    if ( s[i] === 'D' ) d += 1;
    else a += 1;
  }

  console.log(
    a === d ? 'Friendship' : a < d ? 'Danik' : 'Anton'
  );
});

        var length = parseInt(readline()),
        word = readline().split(''),
        Anton = 0,
        Danik = 0;
        for(var i = 0; i  < length; i++){
            if(word[i] == 'A'){
                Anton++;
            } else {
                Danik++;
            }
        }
        if(Anton > Danik){
            print('Anton');
        } else if(Anton == Danik){
            print('Friendship');
        } else {
            print('Danik');
        }

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

const input = [];
readline.on('line', line => input.push(line));

readline.on('close', () => {
    const results = input[1];
    const ac = results.split("A").length - 1;
    const dc = results.length - ac;
    if (ac == dc) console.log("Friendship");
    else if (ac > dc) console.log("Anton");
    else console.log("Danik");
});

function main() {
    let anton = 0;
    let danik = 0;
    const size = nextInt();
    const str = next();
    for(let i=0; i < str.length; i++) {
        if(str[i] === 'A') {
            ++anton;
        } else if(str[i] === 'D') {
            ++danik;
        }
    }

    if(anton > danik) {
        print('Anton');
    } else if( danik > anton) {
        print('Danik');
    } else {
        print('Friendship');
    }

}

// auxiliary code
var curTokens = [],
    curToken = 0;

function next() {
    while (curToken >= curTokens.length) {
        curTokens = readline().split(/[\s]+/);
        curToken = 0;
    }
    return curTokens[curToken++];
}

function nextInt() {
    return parseInt(next());
}

// code for nodejs
var inputBuffer = "",
    curLine = 0;

function readline() {
    return inputBuffer[curLine++];
}

function print(data) {
    process.stdout.write(data + "\n");
}

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

process.stdin.on("data", function (chunk) {
    inputBuffer += chunk;
});

process.stdin.on("end", function () {
    inputBuffer = inputBuffer.split(/[\s]+/);
    main();
});

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

let currentLine = 0;
let inputString = "";

process.stdin.on("data", (raw_data) => {
  inputString += raw_data;
});

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

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

/******** Main function*************/

function main() {
  var n = +readLine();
  var s = readLine().split("");

  var Anton = 0,
    Danik = 0;

  for (var i = 0; i < n; i++) {
    if (s[i] == "A") {
      Anton++;
    } else {
      Danik++;
    }
  }

  if (Anton > Danik) {
    console.log("Anton");
  } else if (Anton == Danik) {
    console.log("Friendship");
  } else {
    console.log("Danik");
  }
}

var l = readline()
var ar = readline().split('')
var a = ar.filter(t=>(t=='A')).length, b = ar.length - a

if ( a > b ) {
  print('Anton')
} else if (a===b){
  print('Friendship')
}
else {
  print('Danik')
}

let fs = require("fs");

let txt = fs.readFileSync(0, "utf-8").split("\r\n").filter(data => {
    return data.length > 0;
});
for (let i = 1; i < txt.length; i += 2) {
    doit(txt[i]);

}

function doit(str) {
    let r = str.length - str.split("").filter(data => {
        return data.length > 0 && data == "D";
    }).length;

    if (r == str.length - r) {
        console.log("Friendship");
    } else if (r < str.length - r) {
        console.log("Danik");
    } else {
        console.log("Anton");

    }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function readAsInt(){
  return parseInt(readline());
}

function readAsIntList(){
  return readline().split(' ').filter(i => i).map(i => parseInt(i));
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  let l = readAsInt();
  let s = readline();
  let d = s.replace(/A+/gi,'').length;
  let a = s.replace(/D+/gi,'').length;
  console.log(a > d ? 'Anton' : ( d > a ? 'Danik' : 'Friendship'));
}

var Ant = 0;
var Dan = 0;
const humans = {
    A: () => { Ant++; },
    D: () => { Dan++; }
};

var buffer = '';

process.stdin.setEncoding('utf8');

process.stdin.on('readable', () => {
    let chunk;
    while ((chunk = process.stdin.read()) !== null) {
        buffer += chunk;
    }
});

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

function solve() {
    buffer = buffer.split('\r\n');

    buffer[1].split('').forEach(element => {
        humans[element]();
    });

    process.stdout.write(Ant == Dan ? "Friendship" : Ant > Dan ? "Anton" : "Danik");
}

// Sample code to perform I/O:

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

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

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

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

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

// Write your code here
function nameLookUp(str) {
    let inputs = str.trim().split('\n');
    let numGames = +inputs[0];
    let winnerMsg = 'Friendship';
    for (let row of inputs[1].trim()) {

        if (row == 'A') {
            numGames--;
        }
        else {
            numGames++;
        }
    }

    if (numGames > +inputs[0]) {
        winnerMsg = 'Danik';
    }
    else if (numGames < +inputs[0]) {
        winnerMsg = 'Anton';
    }

    return winnerMsg.toString();
}

var n = parseInt(readline());
var s = readline();
var a = 0;
var d = 0;
for (var i=0;i<n;i++){
    if (s[i]=="A"){
  	    a++;
    } else if (s[i]=="D"){
  	    d++;
    }
}
if (a>d){
	print("Anton");
} else if (d>a){
	print("Danik");
} else {
	print("Friendship");
}

'use strict';
let n = parseInt(readline());
let danik = readline().replace(new RegExp('A', 'g'), '').length,
    anton = n - danik

if(anton > danik) {
    write('Anton');
} else if (danik > anton) {
    write('Danik');
} else {
    write('Friendship');
}

var n = +readline(),
    line = readline(),
    dc = 0,
    ac = 0;

for(var i = 0; i < n; i++) {
  if (line[i] === "D") {
    dc++;
  } else {
    ac++;
  }
}

print(dc > ac ? "Danik" : dc === ac ? "Friendship" : "Anton");

var number=readline();
countA=0;
var string=readline();

for(var i = 0; i < number; i++){
// print(string[i]);

    if(string[i] == "A"){
        countA++;
        // print(countA);
    }
}
if(countA > number / 2){
    print("Anton");
}
else if(countA == number / 2){
    print("Friendship");
}
else{
    print("Danik");
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let n = parseInt(readLine());
    let count = 0;
    let s = readLine();
    for (var i = 0; i < n; i++) {
        if (s[i] == 'A') {
            count++
        } else count--;
    }
    if (count > 0) {
        console.log('Anton');
    } else if (count < 0) {
        console.log('Danik');
    } else console.log('Friendship');
}

var n = readline();
var str = readline();

var a = 0;
var d=0;
for (var i=0; i<n; i++){
	if(str[i]=="A")
	 a++;
	 else
	 d++;
}
if(a==d) print("Friendship");
else
a>d? print("Anton"):print("Danik")

var nothing = readline();
var matches = readline();

var countA = 0;
var countD = 0;

for(var i = 0; i < matches.length; i++){
    if(matches[i] == "A") countA++
    else if(matches[i] == "D") countD++
}

if(countA > countD){
    print("Anton")
}else if(countA < countD){
    print("Danik")
}else{
    print("Friendship")
}

var numberOfGames = readline().split(' ').map(Number);
var gameResult = readline().split('');
var aCounter = 0;
var dCounter = 0;
var result = '';

for(var i = 0; i < gameResult.length; i++) {
    if(gameResult[i] === 'A') {
        aCounter ++;
    }
    else if(gameResult[i] === 'D') {
        dCounter ++;
    }
}

if(aCounter > dCounter) {
    result = 'Anton';
}
else if(dCounter > aCounter) {
    result = 'Danik';
}
else {
    result = 'Friendship';
}

print(result);

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

rl.on('line', input => {
    let len = input.split('').filter(c => c == 'A').length
    if (len > input.length / 2)
        console.log('Anton')
    else if (len < input.length / 2)
        console.log('Danik')
    else
        console.log('Friendship')
    rl.close()
})

const readline = require('readline');

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

let friendCount, friendNums = [];

rl.on('line', n => {
  n = n.split('');
  const aCount = (n.filter(letter => letter === 'A')).length;
  const dCount = (n.filter(letter => letter === 'D')).length;
  const winner = aCount > dCount ? 'Anton' : aCount < dCount ? 'Danik' : 'Friendship';
  console.log(winner);
  rl.close();
});

const readline = require('readline');

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

rl.on('line', n => {
  n = n.split('');
  const aCount = (n.filter(letter => letter === 'A')).length;
  const dCount = (n.filter(letter => letter === 'D')).length;
  if (aCount > dCount) console.log('Anton');
  if (aCount < dCount) console.log('Danik');
  // if (aCount === dCount) console.log('Friendship');
  rl.close();
});

const readline = require('readline');

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

rl.on('line', n => {
  n = n.split('');
  const aCount = (n.filter(letter => letter === 'A')).length;
  const dCount = (n.filter(letter => letter === 'D')).length;
  console.log(aCount);
  console.log(dCount);
  if (aCount > dCount) {
    console.log('Anton');
    rl.close();
  } else if (aCount < dCount) {
    console.log('Danik');
    rl.close();
  } else if (aCount === dCount) {
    console.log('Friendship');
    rl.close();
  }
});

const readline = require('readline');

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

rl.on('line', n => {
  n = n.split('');
  const aCount = (n.filter(letter => letter === 'A')).length;
  const dCount = (n.filter(letter => letter === 'D')).length;
  if (aCount > dCount) console.log('Anton');
  if (aCount < dCount) console.log('Danik');
  if (aCount === dCount) console.log('Friendship');
  rl.close();
});

const readline = require('readline');

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

rl.on('line', n => {
  n = n.split('');
  const aCount = (n.filter(letter => letter === 'A')).length;
  const dCount = (n.filter(letter => letter === 'D')).length;
  const winner = aCount > dCount ? 'Anton' : aCount < dCount ? 'Danik' : 'Friendship';
  console.log(winner);
  rl.close();
});

const readline = require('readline');

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

rl.on('line', n => {
  n = n.split('');
  const aCount = (n.filter(letter => letter === 'A')).length;
  const dCount = (n.filter(letter => letter === 'D')).length;
  if (aCount > dCount) {
    console.log('Anton');
  } else if (aCount < dCount) {
    console.log('Danik');
  } else {
    console.log('Friendship');
  }
  rl.close();
});

const readline = require('readline');

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

rl.on('line', n => {
  n = n.split('');
  const aCount = (n.filter(letter => letter === 'A')).length;
  const dCount = (n.filter(letter => letter === 'D')).length;
  if (aCount > dCount) {
    console.log('Anton');
  } else if (aCount < dCount) {
    console.log('Danik');
  } else if (aCount === dCount) {
    console.log('Friendship');
  }
});

var all, lines, mainAux, print, readline, rl, rli, sum, who, write;

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

print = console.log;

write = function(...args) {
  return process.stdout.write(args.join(' '));
};

lines = [];

rl.on('line', function(line) {
  return lines.push(line);
});

rl.on('close', main);

rli = 0;

readline = function() {
  return lines[rli++];
};

sum = function(items) {
  return items.reduce(function(a, b) {
    return a + b;
  });
};

all = function(items) {
  var i, item, len;
  for (i = 0, len = items.length; i < len; i++) {
    item = items[i];
    if (!item) {
      return false;
    }
  }
  return true;
};

who = function(n, gs) {
  console.log(gs);
  switch (false) {
    case !(sum(gs.split('').map(function(g) {
        if (g === 'A') {
          return 1;
        } else {
          return 0;
        }
      })) > Math.floor(n / 2)):
      return print('Anton');
    case !(sum(gs.split('').map(function(g) {
        if (g === 'D') {
          return 1;
        } else {
          return 0;
        }
      })) > Math.floor(n / 2)):
      return print('Danik');
    default:
      return print('Friendship');
  }
};

//who = (n, gs) ->
//  asum = sum(
//    for g in gs
//      if g is 'A' then 1 else 0
//  )
//  if asum > n - asum then print('Anton')
//  else if asum < n - asum then print('Danik')
//  else print('Friendship')
mainAux = function() {
  var g, n;
  n = parseInt(readline());
  g = readline();
  return who(n, g);
};

  function main() {
    return mainAux();
  }
;

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

/****** BELOW HERE START WRITING YOUR CODE IN main() FUNCTION   ***************************************/
/**
 * Use "readLine()" function for input, which will return a string consisting the entire line, so accordingly split the string
 * when required.
 *
 * I am using console.log() to output
 */
function main() {
    let t = readLine();

    antonAndDanik(t)

}

function antonAndDanik(str) {
  let aCount = 0;
  let dCount = 0;

  for (let char of str) {
    if (char === "A") aCount++;

    if (char === "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

     antonAndDanik(x);
 }

function antonAndDanik(str) {
  let aCount = 0;
  let dCount = 0;

  for (let char of str) {
    if (char === "A") aCount++;

    if (char === "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x1 = readline();
        const x2 = readline();

     antonAndDanik(x2);
 }

function antonAndDanik(str) {
    console.log(str)

   let aCount = 0;
  let dCount = 0;

  let strARR = str.split("");

  for (let i = 0; i < strARR.length; i++) {
    const char = strARR[i];

    if (char == "A") aCount++;

    if (char == "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

     antonAndDanik(x);
 }

function antonAndDanik(str) {
  let aCount = 0;
  let dCount = 0;

  for (let char of str) {
    if (char === "A") aCount++;

    if (char === "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else if(aCount==dCount) {
    console.log("Friendship");
    return "Friendship";
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

     antonAndDanik(x);
 }

function antonAndDanik(str) {
   let aCount = 0;
  let dCount = 0;

  let strARR = str.split("");

  // for (let char of str) {
  // for (let char of strARR) {
  for (let i = 0; i < strARR.length; i++) {
    const char = strARR[i];

    if (char === "A") aCount++;

    if (char === "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

//%easy
function antonAndDanik(str) {
  let aCount = 0;
  let dCount = 0;

  for (char of str) {
    if (char === "A") aCount++;

    if (char === "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

console.log(antonAndDanik("ADAAAA"));
console.log(antonAndDanik("DDDAADA"));
console.log(antonAndDanik("DADADA"));

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

let inputString = "";
let currentLine = 0;

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

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

  main();
});

function readline() {
  return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const x = readline();

  antonAndDanik(x);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

     antonAndDanik(x);
 }

function antonAndDanik(str) {
    console.log(str)

   let aCount = 0;
  let dCount = 0;

  let strARR = str.split("");

  for (let i = 0; i < strARR.length; i++) {
    const char = strARR[i];

    if (char == "A") aCount++;

    if (char == "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

     antonAndDanik(x);
 }

function antonAndDanik(str) {
   let aCount = 0;
  let dCount = 0;

  let strARR = str.split("");

  // for (let char of str) {
  for (let char of strARR) {
    if (char == "A") aCount++;

    if (char == "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

     antonAndDanik(x);
 }

function antonAndDanik(str) {
   let aCount = 0;
  let dCount = 0;

  let strARR = str.split("");

  // for (let char of str) {
  for (let char of strARR) {
    if (char === "A") aCount++;

    if (char === "D") dCount++;
  }

  if (aCount > dCount) {
    console.log("Anton");
    return "Anton";
  } else if (dCount > aCount) {
    console.log("Danik");
    return "Danik";
  } else {
    console.log("Friendship");
    return "Friendship";
  }
}

var input = '';

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

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

function main(input) {

    let inputArr = input.split('\n');

    let str = inputArr[1].split('');

    let a = 0, d = 0;
    for (let i = 0; i < str.length; i++) {
        if (str[i] === 'A')
            a++;
        else
            d++;
    }

    if (a > d) {
        console.log('Anton');
    }
    else if (a < d) {
        console.log('Danik');
    }
    else if (a === d) {
        console.log('Friendship');
    }

}

var input = '';

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

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

function main(input) {

    let inputArr = input.split('\n');

    let str = inputArr[1].split('');

    let a = 0, d = 0;
    for (let i = 0; i < str.length; i++) {
        if (str[i] === 'A')
            a++;
        else
            d++;
    }

    if (a > d) {
        console.log('Anton');
    }
    else if (a < d) {
        console.log('Danik');
    }
    else {
        console.log('Friendship');
    }

}

var n = parseInt(readline());
	var s = readline().split(" ");
	var len = s.length;
	var ans = 0;
	for(var i = 0; i < len; i++)
	{
		if(s[i] == 'A')
			ans ++;
	}
	var flag;
	if(ans > len-ans)
	{
		flag = "Anton";
	}
	else if(ans < len-ans)
	{
		flag = "Danik";
	}
	else flag = "Friendship";
	print(flag);

var num_games = parseInt(readline());
var result = readline();
var obj = {};
var Anton = 0;
var Danik = 0;
for(var i of result){
    if(i=="A")Anton++;
    if(i=="D")Danik++;
}
if(Anton> Danik)print("Anton");
else print("Danik");

var num_games = parseInt(readline());
var results = readline().split("");
var A = 0;
var D = 0;
for(var i =0; i< num_games; i++){
    if(results[i]=='A') A++;
    if(results[i]=='D') D++;
}
if(A>D)print("Anton")
else print("Danik")

var games = +readline();
var sequence = readline();
AntonWinnings = sequence.split('').reduce(function(wins, letter){
	return wins + (letter == 'A'?1:0);
}, 0);

if(~~(games/2) > AntonWinnings){
	print('Danik');
}else if(~~(games/2) < AntonWinnings){
	print('Anton')
}
else{
	print('Friendship');
}

var res = sol(readline(), readline());
print(res);

function sol(line, log) {
    var input = line.split(" ");
    var logs = log.split(" ");

    var n = input[0];
    var history = logs[0];

    var anton = 0;
    var denik = 0;

    while(n > 0){
        if(history[n - 1] == "A"){
            anton++;
        }else{
            denik++;
        }
        n--;
    }

    var winner = "";
    if(anton > denik){
        winner = "Anton";
    }else if(anton < denik){
        winner = "Denik";
    }else{
        winner = "Friendship";
    }

    return winner;
}

var res = sol(readline(), readline());
print(res);

function sol(line, log) {
    var input = line.split(" ");
    var logs = log.split(" ");

    var n = input[0];
    var history = logs[0];

    var anton = 0;
    var denik = 0;

    while(n > 0){
        if(history[n - 1] == "A"){
            anton++;
        }else{
            denik++;
        }
        n--;
    }

    var winner = "";
    if(anton > denik){
        winner = "A";
    }else if(anton < denik){
        winner = "D";
    }else{
        winner = "Friendship";
    }

    return winner;
}

(function() {
    'use strict';
    const n = readline();
    const z = readline().split('');
    var a;
    var d;
    for (let i = 0; i < n; ++i) {
        if (z[i] === 'A') {
            a += 1;
        } else {
            d += 1;
        }
    }

    if (a > d) {
        print('Anton');
    } else if (a === d) {
        print('Friendship');
    } else {
        print('Danik');
    }
}());

function program(input){
    // var first = input[0].toUpperCase();
    var A = 0;
    var D = 0;
    for(var i=1;i<input.length;i++){
        if(input.charAt(i) === 'A' || input.charAt(i) === 'a' ){
            A++;
        }
        else if(input.charAt(i) === 'D' || input.charAt(i) === 'd' ){
            D++;
        }

    }
    if(A > D){
        print('Anton')
    }
    else{
        print('Danik')
    }
}
var input = readline();
program(input);

function program(input,n){
    // var first = input[0].toUpperCase();
    var A = 0;
    var D = 0;
    for(var i=0;i<n-1;i++){
        if(input.charAt(i) === 'A' || input.charAt(i) === 'a' ){
            A++;
        }
        else if(input.charAt(i) === 'D' || input.charAt(i) === 'd' ){
            D++;
        }

    }
    if(A > D){
        print('Anton')
    }
    else if(A < D){
        print('Danik')
    }
    else if(A === D){
        print('Friendship')
    }
    else{
        print('Friendship')
    }
}
var n = readline();
var input = readline()
program(input,n)

function program(input,n){
    // var first = input[0].toUpperCase();
    var A = 0;
    var D = 0;
    for(var i=0;i<n-1;i++){
        if(input.charAt(i) === 'A' || input.charAt(i) === 'a' ){
            A++;
        }
        else if(input.charAt(i) === 'D' || input.charAt(i) === 'd' ){
            D++;
        }

    }
    if(A > D){
        print('Anton')
    }
    else if(A < D){
        print('Danik')
    }
    else if(A === D){
        print('Friendship')
    }

}
var n = readline();
var input = readline()
program(input,n)

function program(input){
    // var first = input[0].toUpperCase();
    var A = 0;
    var D = 0;
    for(var i=0;i<input.length;i++){
        if(input.charAt(i) === 'A' || input.charAt(i) === 'a' ){
            A++;
        }
        else if(input.charAt(i) === 'D' || input.charAt(i) === 'd' ){
            D++;
        }

    }
    if(A > D){
        print('Anton')
    }
    else if(A < D){
        print('Danik')
    }
    else{
        print('Friendship')
    }
}
var input = readline();
program(input);

        var word = readline().split(''),
        Anton = 0,
        Danik = 0;
        for(var i = 0; i  < word.length; i++){
            if(word[i] == 'A'){
                Anton++;
            } else {
                Danik++;
            }
        }
        if(Anton > Danik){
            print('Anton');
        } else if(Anton == Danik){
            print('Friendship');
        } else {
            print('Danik');
        }

var l = readline()
var ar = readline().split('').map(t=>(t=='A'))
var a = ar.filter(t=>(t=='A')).length, b = ar.length - a

if ( a > b ) {
  print('Anton')
} else {
  print('Danik')
}

var l = readline()
var a = 0, b = 0;
var ar = readline().split('').map(t=>(t=='A'))

if ( ar.filter(t=>(t=='A')).length > ar.length ) {
  print('Anton')
} else {
  print('Danik')
}

var l = readline()
var ar = readline().split('')
var a = ar.filter(t=>(t=='A')).length, b = ar.length - a

if ( a > b ) {
  print('Anton')
} else {
  print('Danik')
}

var n = +readline(),
    line = readline(),
    dc = 0,
    ac = 0;

for(var i = 0; i < n; i++) {
  if (line[i] === "D") {
    dc++;
  } else {
    ac++;
  }
}

print(dc > ac ? "Danik" : dc === ac ? "Friendship" : "Danik");

var n = readline();
var str = readline();

var a = 0;
var d=0;
for (var i=0; i<n; i++){
	if(str[i]=="A")
	 a++;
	 else (str[i]="D")
	 d++;
}
a<d? print("Anton"):print("Danik");

var n = readline();
var str = readline();

var a = 0;
var d=0;
for (var i=0; i<n; i++){
	if(str[i]=="A")
	 a++;
	else (str[i]="D")
	 d++;
}
a>d? print("Anton"):print("Danil");

var n = readline();
var str = readline();

var a = 0;
var d=0;
for (var i=0; i<n; i++){
	if(str[i]=="A")
	 a++;
	 else
	 d++;
}
a>d? print("Anton"):print("Danik");

var n = readline().split(" ").map(x => parseInt(x));
var s = readline().split(" ").map(x => parseInt(x));
var antonPlayedGames = 0;
var danikPlayedGames = 0;
for(var i = 0; i < n; ++i) {
    if(s[i] == "A") {
        ++antonPlayedGames;
    } else {
        ++danikPlayedGames;
    }
}

if(antonPlayedGames > danikPlayedGames) {
    print("Anton");
} else if(danikPlayedGames > antonPlayedGames) {
    print("Danik");
} else {
    print("Friendship");
}

(function main() {
	var n = readline();
	var line = readline();
	var len = parseInt(n);
	var aCon = 0;
	var dCon = 0;
	var c = 0;
	for (var i = 0; i < len; i++) {
		if (line[i] === "A") {
			aCon += 1;
		} else {
			dCon += 1;
		}
	}

		print('aCon: ' + aCon + ' ,dCon: ' + dCon);

	if (aCon > dCon) {
		print('Danik');
	} else if (aCon === dCon) {
		print('Friendship');
	} else {
		print('Anton');
	}
	c++;

})();

(function main() {
	var line = readline();
	var len = line.length;
	var aCon = 0;
	var dCon = 0;
	for (var i = 0; i < len; i++) {
		if (line[i] === "A") {
			aCon += 1;
		} else {
			dCon += 1;
		}
	}
	if (aCon > dCon) {
		print('Danik');
	} else if (aCon === dCon) {
		print('Friendship');
	} else {
		print('Anton');
	}

})();

(function main() {
	var n = readline();
	var line = readline();
	var len = parseInt(n);
	var aCon = 0;
	var dCon = 0;
	var c = 0;
	for (var i = 0; i < len; i++) {
		if (line[i] === "A") {
			aCon += 1;
		} else {
			dCon += 1;
		}
	}
	if (c !== 0) {
		print('aCon: ' + aCon + ' ,dCon: ' + dCon);
	}
	if (aCon > dCon) {
		print('Danik');
	} else if (aCon === dCon) {
		print('Friendship');
	} else {
		print('Anton');
	}
	c++;

})();

(function main() {
	var line = readline();
	var len = line.length;
	var aCon = 0;
	var dCon = 0;
	var c = 0;
	for (var i = 0; i < len; i++) {
		if (line[i] === "A") {
			aCon += 1;
		} else {
			dCon += 1;
		}
	}
	if (c !== 0) {
		print('aCon: ' + aCon + ' ,dCon: ' + dCon);
	}
	if (aCon > dCon) {
		print('Danik');
	} else if (aCon === dCon) {
		print('Friendship');
	} else {
		print('Anton');
	}
	c++;

})();

(function main() {
	var n = readline();
	var line = readline();
	var len = parseInt(n);
	var aCon = 0;
	var dCon = 0;
	var c = 0;
	for (var i = 0; i < len; i++) {
		if (line[i] === "A") {
			aCon += 1;
		} else {
			dCon += 1;
		}
	}

		print('aCon: ' + aCon + ' ,dCon: ' + dCon);

	if (aCon > dCon) {
		print('Anton');
	} else if (aCon === dCon) {
		print('Friendship');
	} else {
		print('Danik');
	}
	c++;

})();

var n = Number(readline());
var string = readline();

function counter(n, string) {
    var array = string.split('');
    var a = 0;
    var d = 0;

    for(var i = 0; i < n; i++) {
        if(array[i] == 'A') {
            a++
        } else {
            d++
        }
    }

    return [a, d];
}

function getResult(n, string) {
    var results = counter(n, string);
    var a = results[0];
    var d = results[1];

    if(a > d) {
        return 'Anton';
    } else if(a < d) {
        return 'Danik';
    } else {
        return 'Friendship';
    }

}

var v1 = readline();
var v2 = readline();
var a = 0;
var i = 0;

while(i< v1 && a<= v1/2){
  if(v2[i] == 'A'){
    a++;
  }
  i++;
}

var result = a > v1/2 ? 'Anton' : (a < v1/2 ? 'Danik' : 'Friendship');

var n = readline();
var s= readline();
var A=0, D=0;
for(var i=0; i<s.length; i++){
    if(s[i] == 'A'){
        A++;
    }else{
        D++;
    }
    if(A>D){
        print('Anton');

    }else if(D>A){
        print('Danik');
    }else{
        print('Friendship');
    }
}

var n = Number(readline());
var s= readline();
var a=0, d=0;
for(var i=0; i<s.length; i++){
    if(s[i] === 'A'){
        a++;
    }else{
        d++;
    }
    if(a>d){
        print('Anton');

    }else if(a<d){
        print('Danik');
    }else{
        print('Friendship');
    }
}

var n = readline();
var s= readline();
var a=0, d=0;
for(var i=0; i< s.length; i++){
    if(s[i] === 'a'){
        a++;
    }else{
        d++;
    }
    if(a>d){
        print('Anton');
    }else if(a<d){
        print('Danik');
    }else{
        print('Friendship');
    }
}

var n = readline();
var s= readline();
var A=0, D=0;
for(var i=0; i<s.length; i++){
    if(s[i]== 'A'){
        A++;
    }else{
        D++;
    }
    if(A>D){
        print('Anton');

    }else if(D>A){
        print('Danik');
    }else{
        print('Friendship');
    }
}

var n = readline();
var s= readline();
var a=0, d=0;
for(var i=0; i< s.length; i++){
    if(s[i] === 'A'){
        a++;
    }else{
        d++;
    }
    if(a>d){
        print('Anton');
    }else if(a<d){
        print('Danik');
    }else{
        print('Friendship');
    }
}

var n = readline();
var s= readline();
var a=0, d=0;
for(var i=0; i<s.length; i++){
    if(s[i] === 'A'){
        a++;
    }else{
        d++;
    }
    if(a>d){
        print('Anton');

    }else if(a<d){
        print('Danik');
    }else{
        print('Friendship');
    }
}

var n = readline();
var s= readline();
var A=0, D=0;
for(var i=0; i<s.length; i++){
    if(s[i] == 'A'){
        A++;
    }else{
        D++;
    }
    if(A>D){
        print('Anton');

    }else if(A<D){
        print('Danik');
    }else{
        print('Friendship');
    }
}

var n = readline();
var s= readline();
var A=0, D=0;
for(var i=0; i<s.length; i++){
    A= A+s[i]=='A';
    D= D+s[i]=='D';
}
    if(A>D){
        print('Anton');

    }else if(A<D){
        print('Danik');
    }else{
        print('Friendship');
    }

var input = readline();
var len1 = input.replace(/D/g, '');
var len2 = input.replace(/A/g, '');
if(len1>len2)print("Anton");
if(len1<len2)print("Danik");
if(len1===len2)print("Friendship");

var input = readline();
var len1 = input.replace(/D/g, '');
var len2 = input.replace(/A/g, '');
if(len1>len2){print("Anton")}
if(len1<len2){print("Danik")}
if(len1===len2){print("Friendship")}

var N = readline();var input = readline();
var len1 = input.replace(/D/g, '');
var len2 = input.replace(/A/g, '');
if(len1>len2){print("Anton")}
if(len1<len2){print("Danik")}
if(len1===len2){print("Friendship")}

var input = readline();
var len1 = input.length;
var len2 = input.replace(/A/g, '');
if(len1>len2)print("Anton");
if(len1<len2)print("Danik");
if(len1===len2)print("Friendship");

var games = parseInt(readline());
var winners = readline().split(" ").map(x => parseInt(x));

var obj = {
    A: 0,
    D: 0
}

for (var i = 0; i < games.length; i++ ) {
    if (winners[i] === 'A') {
        obj['A']++;
    } else if (winners[i] === 'D') {
        obj['D']++;
    }
}

if (obj['A'] === obj['D']) {
    print('Friendship');
} else if (obj['A'] > obj['D']) {
    print('Anton');
} else {
    print('Danik')
}

var games = parseInt(readline());
var winners = readline().split(" ").map(x => parseInt(x));

var obj = {
    'A': 0,
    'D': 0
}

for (var i = 0; i < games.length; i++ ) {
    if (winners[i] === 'A') {
        obj['A']++;
    } else if (winners[i] === 'D') {
        obj['D']++;
    }
}

if (obj['A'] === obj['D']) {
    print('Friendship');
} else if (obj['A'] > obj['D']) {
    print('Anton');
} else {
    print('Danik')
}


let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) != null) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) != null) return res;
    }
  }
}

function Arr(a, b, fn, init) {
  if (a < b) {
    let arr = Array(b + 1);
    if (init) init(arr);
    for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
    return arr;
  } else {
    let arr = Array(a + 1);
    if (init) init(arr);
    for (let i = a; i >= b; i--) arr[i] = fn(i, arr);
    return arr;
  }
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);
// let MOD = 998244353n;
// let gt = Arr(0, n, (i, a) => i == 0 ? 1n : a[i - 1] * BigInt(i) % MOD);
// let rgt = Arr(0, n, (i, a) => i <= 1 ? 1n : MOD - MOD / BigInt(i) * a[998244353 % i] % MOD);
// for (let i = 2; i < n; i++) rgt[i] = rgt[i] * rgt[i - 1] % MOD;
// let nCk = (n, k) => {
//   return gt[n] * rgt[k] * rgt[n - k] % MOD;
// }
// for (let i = dm[l.l]; i <= n + n; i += i & -i) s[i]++; // start from index 1

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let test = inp[r++];
  while (test--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    t = new SplayTree();
    for (let i = 0; i < n; i++) t.insert(i, a[i]);
    console.log(t.root.p);
  }
})();

class Node {
  left; right; key; value; p; m; pm; mp;
  constructor(key, value) {
    this.key = key;
    this.value = value;
    this.p = value;
    this.m = -value;
    this.pm = -1e10;
    this.mp = -1e10;
  }
  update() {
    if (this.left && this.right) {
      this.p = Math.max(this.left.p, this.right.p, this.value, this.left.p + this.right.mp, this.left.pm + this.right.p, this.left.pm + this.value, this.value + this.right.mp, this.left.p - this.value + this.right.p, this.left.pm + this.value + this.right.mp);
      this.m = Math.max(this.left.m, this.right.m, -this.value, this.left.mp - this.value, -this.value + this.right.pm, this.left.mp + this.right.m, this.left.m + this.right.pm, this.left.mp - this.value + this.right.pm, this.left.m + this.value + this.right.m);
      this.pm = Math.max(this.left.pm, this.right.pm, this.left.p + this.right.m, this.left.pm + this.right.pm, this.left.p - this.value, this.value + this.right.m, this.left.pm + this.value + this.right.m, this.left.p - this.value + this.pm);
      this.mp = Math.max(this.left.mp, this.right.mp, this.left.m + this.right.p, this.left.mp + this.right.mp, this.left.m + this.value, -this.value + this.right.p, this.left.mp - this.value + this.right.p, this.left.m + this.value + this.mp);
    } else if (this.left) {
      this.p = Math.max(this.value, this.left.p, this.left.pm + this.value);
      this.m = Math.max(-this.value, this.left.m, this.left.mp - this.value);
      this.pm = Math.max(this.left.pm, this.left.p - this.value);
      this.mp = Math.max(this.left.mp, this.left.m + this.value);
    } else if (this.right) {
      this.p = Math.max(this.value, this.right.p, this.value + this.right.mp);
      this.m = Math.max(-this.value, this.right.m, -this.value + this.right.pm);
      this.pm = Math.max(this.right.pm, this.value + this.m);
      this.mp = Math.max(this.right.mp, -this.value + this.p);
    }
  }
  // toString() {
  //   return (this.left ? this.left.toString() + ' ' : '') + `${this.key},${this.min},${this.max}` + (this.right ? ' ' + this.right.toString() : '')
  // }
}

class SplayTree {
  root;
  constructor(node) {
    this.root = node;
  }

  uptree(x, p, g) {
    if (!g) {
      // lazy update p, x
      if (p.left == x) {
        p.left = x.right;
        x.right = p;
      } else {
        p.right = x.left;
        x.left = p;
      }
      p.update(); x.update();
      return x;
    }
    // lazy update g, p, x
    if (g.left == p && p.left == x) {
      g.left = p.right;
      p.right = g;
      p.left = x.right;
      x.right = p;
    } else if (g.right == p && p.right == x) {
      g.right = p.left;
      p.left = g;
      p.right = x.left;
      x.left = p;
    } else if (g.left == p) {
      p.right = x.left;
      x.left = p;
      g.left = x.right;
      x.right = g;
    } else {
      p.left = x.right;
      x.right = p;
      g.right = x.left;
      x.left = g;
    }
    g.update(); p.update(); x.update();
    return x;
  }

  splay(trace) {
    var x = trace.pop();
    while (true) {
      var p = trace.pop();
      var g = trace.pop();
      if (!p) return this.root = x;
      if (!g || !trace.length) return this.root = this.uptree(x, p, g);
      if (trace[trace.length - 1].left == g) trace[trace.length - 1].left = x = this.uptree(x, p, g);
      else trace[trace.length - 1].right = x = this.uptree(x, p, g);
    }
  }

  insert(key, value) {
    if (!this.root) return this.root = new Node(key, value);
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur = trace[trace.length - 1];
    if (key < cur.key) trace.push[cur.left = new Node(key, value)];
    else trace.push[cur.right = new Node(key, value)];
    cur.update();
    this.splay(trace);
  }

  join(tree) {
    if (!this.root) return this.root = tree.root;
    var trace = [this.root];
    var cur = this.root;
    while (cur.right) trace.push(cur = cur.right);
    this.splay(trace);
    this.root.right = tree.root;
    this.root.update();
  }

  remove(key) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    if (trace[trace.length - 1].key != key) return;
    this.splay(trace);
    var tree = new SplayTree(this.root.right);
    this.root = this.root.left;
    this.join(tree);
  }

  res() {
    if (!this.root) return 0;
    return (this.root.max - this.root.min - this.root.maxGap) || 0
  }

  print() {
    console.log(this.root ? this.root.toString() : undefined);
  }
}

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

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var N = nextInt();
    var list = nextIntArray();
    var max = 0;
    for(var j = 1; j < N - 1; j++){
      if(list[j] > list[j + 1] && list[j - 1] < list[j]){
        max += list[j];
      }
      if(list[j] < list[j + 1] && list[j - 1] > list[j]){
        max -= list[j];
      }
    }
    if(N >= 2){
      if(list[0] > list[1]){
        max += list[0];
      }
      if(list[N - 1] > list[N - 2]){
        max += list[N - 1];
      }
    }else{
      max = 1;
    }

    output[i] = max;
  }
  myout(myconv(output, 9));
}

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) != null) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) != null) return res;
    }
  }
}

function Arr(a, b, fn, init) {
  if (a < b) {
    let arr = Array(b + 1);
    if (init) init(arr);
    for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
    return arr;
  } else {
    let arr = Array(a + 1);
    if (init) init(arr);
    for (let i = a; i >= b; i--) arr[i] = fn(i, arr);
    return arr;
  }
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);
// let MOD = 998244353n;
// let gt = Arr(0, n, (i, a) => i == 0 ? 1n : a[i - 1] * BigInt(i) % MOD);
// let rgt = Arr(0, n, (i, a) => i <= 1 ? 1n : MOD - MOD / BigInt(i) * a[998244353 % i] % MOD);
// for (let i = 2; i < n; i++) rgt[i] = rgt[i] * rgt[i - 1] % MOD;
// let nCk = (n, k) => {
//   return gt[n] * rgt[k] * rgt[n - k] % MOD;
// }
// for (let i = dm[l.l]; i <= n + n; i += i & -i) s[i]++; // start from index 1

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let test = inp[r++];
  while (test--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    t = new SplayTree();
    for (let i = 0; i < n; i++) t.insert(i, a[i])
    console.log(t.root.p);
    // t.print();
    for (let i = 0; i < q; i++) {
      let li = inp[r++], ri = inp[r++];
      t.update(li - 1, a[ri - 1]);
      // t.print();
      t.update(ri - 1, a[li - 1]);
      // t.print();
      let temp = a[li - 1];
      a[li - 1] = a[ri - 1];
      a[ri - 1] = temp;
      console.log(t.root.p);
    }
  }
})();

class Node {
  left; right; key; value; p; m; pm; mp; size;
  constructor(key, value) {
    this.key = key;
    this.value = value;
    this.p = value;
    this.m = -value;
    this.pm = -1e10;
    this.mp = -1e10;
    this.size = 1;
  }
  update() {
    this.size = 1 + (this.left ? this.left.size : 0) + (this.right ? this.right.size : 0);
    if (this.left && this.right) {
      this.p = Math.max(this.left.p, this.right.p, this.value, this.left.p + this.right.mp, this.left.pm + this.right.p, this.left.pm + this.value, this.value + this.right.mp, this.left.p - this.value + this.right.p, this.left.pm + this.value + this.right.mp);
      this.m = Math.max(this.left.m, this.right.m, -this.value, this.left.mp - this.value, -this.value + this.right.pm, this.left.mp + this.right.m, this.left.m + this.right.pm, this.left.mp - this.value + this.right.pm, this.left.m + this.value + this.right.m);
      this.pm = Math.max(this.left.pm, this.right.pm, this.left.p + this.right.m, this.left.pm + this.right.pm, this.left.p - this.value, this.value + this.right.m, this.left.pm + this.value + this.right.m, this.left.p - this.value + this.right.pm);
      this.mp = Math.max(this.left.mp, this.right.mp, this.left.m + this.right.p, this.left.mp + this.right.mp, this.left.m + this.value, -this.value + this.right.p, this.left.mp - this.value + this.right.p, this.left.m + this.value + this.right.mp);
    } else if (this.left) {
      this.p = Math.max(this.value, this.left.p, this.left.pm + this.value);
      this.m = Math.max(-this.value, this.left.m, this.left.mp - this.value);
      this.pm = Math.max(this.left.pm, this.left.p - this.value);
      this.mp = Math.max(this.left.mp, this.left.m + this.value);
    } else if (this.right) {
      this.p = Math.max(this.value, this.right.p, this.value + this.right.mp);
      this.m = Math.max(-this.value, this.right.m, -this.value + this.right.pm);
      this.pm = Math.max(this.right.pm, this.value + this.right.m);
      this.mp = Math.max(this.right.mp, -this.value + this.right.p);
    } else {
      this.p = this.value;
      this.m = -this.value;
      this.pm = -1e10;
      this.mp = -1e10;
    }
  }
  toString() {
    return (this.left ? this.left.toString() + ' ' : '') + `(${this.key},${this.size},${this.value},${this.p},${this.m},${this.pm},${this.mp})` + (this.right ? ' ' + this.right.toString() : '')
  }
}

class SplayTree {
  root;
  constructor(node) {
    this.root = node;
  }

  uptree(x, p, g) {
    if (!g) {
      // lazy update p, x
      if (p.left == x) {
        p.left = x.right;
        x.right = p;
      } else {
        p.right = x.left;
        x.left = p;
      }
      p.update(); x.update();
      return x;
    }
    // lazy update g, p, x
    if (g.left == p && p.left == x) {
      g.left = p.right;
      p.right = g;
      p.left = x.right;
      x.right = p;
    } else if (g.right == p && p.right == x) {
      g.right = p.left;
      p.left = g;
      p.right = x.left;
      x.left = p;
    } else if (g.left == p) {
      p.right = x.left;
      x.left = p;
      g.left = x.right;
      x.right = g;
    } else {
      p.left = x.right;
      x.right = p;
      g.right = x.left;
      x.left = g;
    }
    g.update(); p.update(); x.update();
    return x;
  }

  splay(trace) {
    var x = trace.pop();
    while (true) {
      var p = trace.pop();
      var g = trace.pop();
      if (!p) return this.root = x;
      if (!g || !trace.length) return this.root = this.uptree(x, p, g);
      if (trace[trace.length - 1].left == g) trace[trace.length - 1].left = x = this.uptree(x, p, g);
      else trace[trace.length - 1].right = x = this.uptree(x, p, g);
    }
  }

  insert(key, value) {
    if (!this.root) return this.root = new Node(key, value);
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur = trace[trace.length - 1];
    if (key < cur.key) trace.push(cur.left = new Node(key, value));
    else trace.push(cur.right = new Node(key, value));
    // cur.update();
    this.splay(trace);
  }

  join(tree) {
    if (!this.root) return this.root = tree.root;
    var trace = [this.root];
    var cur = this.root;
    while (cur.right) trace.push(cur = cur.right);
    this.splay(trace);
    this.root.right = tree.root;
    this.root.update();
  }

  remove(key) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    if (trace[trace.length - 1].key != key) return;
    this.splay(trace);
    var tree = new SplayTree(this.root.right);
    this.root = this.root.left;
    this.join(tree);
  }

  update(key, value) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur.value = value;
    // for (let i = trace.length - 1; i >= 0; i--) {
    //   trace[i].update();
    // }
    this.splay(trace);
  }

  res() {
    if (!this.root) return 0;
    return (this.root.max - this.root.min - this.root.maxGap) || 0
  }

  print() {
    return;
    console.log(this.root ? this.root.toString() : undefined);
  }
}

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    for (let i = 1; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(cong[n - 1]);
  }
})();

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);
// let MOD = 998244353n;
// let gt = Arr(0, n, (i, a) => i == 0 ? 1n : a[i - 1] * BigInt(i) % MOD);
// let rgt = Arr(0, n, (i, a) => i <= 1 ? 1n : MOD - MOD / BigInt(i) * a[998244353 % i] % MOD);
// for (let i = 2; i < n; i++) rgt[i] = rgt[i] * rgt[i - 1] % MOD;
// let nCk = (n, k) => {
//   return gt[n] * rgt[k] * rgt[n - k] % MOD;
// }
// for (let i = dm[l.l]; i <= n + n; i += i & -i) s[i]++; // start from index 1

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let test = inp[r++];
  let ans = [];
  while (test--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    t = new SplayTree();
    for (let i = 0; i < n; i++) t.insert(i, a[i])
    ans.push(t.root.p);
    // t.print();
    for (let i = 0; i < q; i++) {
      let li = inp[r++], ri = inp[r++];
      t.update(li - 1, a[ri - 1]);
      // t.print();
      t.update(ri - 1, a[li - 1]);
      // t.print();
      let temp = a[li - 1];
      a[li - 1] = a[ri - 1];
      a[ri - 1] = temp;
      ans.push(t.root.p);
    }
  }
  console.log(ans.join('\n'));
})();

class Node {
  left; right; key; value; p; m; pm; mp;
  constructor(key, value) {
    this.key = key;
    this.value = value;
    this.p = value;
    this.m = -value;
    this.pm = -1e10;
    this.mp = -1e10;
  }
  update() {
    if (this.left && this.right) {
      this.p = Math.max(this.left.p, this.right.p, this.value, this.left.p + this.right.mp, this.left.pm + this.right.p, this.left.pm + this.value, this.value + this.right.mp, this.left.p - this.value + this.right.p, this.left.pm + this.value + this.right.mp);
      this.m = Math.max(this.left.m, this.right.m, -this.value, this.left.mp - this.value, -this.value + this.right.pm, this.left.mp + this.right.m, this.left.m + this.right.pm, this.left.mp - this.value + this.right.pm, this.left.m + this.value + this.right.m);
      this.pm = Math.max(this.left.pm, this.right.pm, this.left.p + this.right.m, this.left.pm + this.right.pm, this.left.p - this.value, this.value + this.right.m, this.left.pm + this.value + this.right.m, this.left.p - this.value + this.right.pm);
      this.mp = Math.max(this.left.mp, this.right.mp, this.left.m + this.right.p, this.left.mp + this.right.mp, this.left.m + this.value, -this.value + this.right.p, this.left.mp - this.value + this.right.p, this.left.m + this.value + this.right.mp);
    } else if (this.left) {
      this.p = Math.max(this.value, this.left.p, this.left.pm + this.value);
      this.m = Math.max(-this.value, this.left.m, this.left.mp - this.value);
      this.pm = Math.max(this.left.pm, this.left.p - this.value);
      this.mp = Math.max(this.left.mp, this.left.m + this.value);
    } else if (this.right) {
      this.p = Math.max(this.value, this.right.p, this.value + this.right.mp);
      this.m = Math.max(-this.value, this.right.m, -this.value + this.right.pm);
      this.pm = Math.max(this.right.pm, this.value + this.right.m);
      this.mp = Math.max(this.right.mp, -this.value + this.right.p);
    } else {
      this.p = this.value;
      this.m = -this.value;
      this.pm = -1e10;
      this.mp = -1e10;
    }
  }
  // toString() {
  //   return (this.left ? this.left.toString() + ' ' : '') + `(${this.key},${this.size},${this.value},${this.p},${this.m},${this.pm},${this.mp})` + (this.right ? ' ' + this.right.toString() : '')
  // }
}

class SplayTree {
  root;
  constructor(node) {
    this.root = node;
  }

  uptree(x, p, g) {
    if (!g) {
      // lazy update p, x
      if (p.left == x) {
        p.left = x.right;
        x.right = p;
      } else {
        p.right = x.left;
        x.left = p;
      }
      p.update(); x.update();
      return x;
    }
    // lazy update g, p, x
    if (g.left == p && p.left == x) {
      g.left = p.right;
      p.right = g;
      p.left = x.right;
      x.right = p;
    } else if (g.right == p && p.right == x) {
      g.right = p.left;
      p.left = g;
      p.right = x.left;
      x.left = p;
    } else if (g.left == p) {
      p.right = x.left;
      x.left = p;
      g.left = x.right;
      x.right = g;
    } else {
      p.left = x.right;
      x.right = p;
      g.right = x.left;
      x.left = g;
    }
    g.update(); p.update(); x.update();
    return x;
  }

  splay(trace) {
    var x = trace.pop();
    while (true) {
      var p = trace.pop();
      var g = trace.pop();
      if (!p) return this.root = x;
      if (!g || !trace.length) return this.root = this.uptree(x, p, g);
      if (trace[trace.length - 1].left == g) trace[trace.length - 1].left = x = this.uptree(x, p, g);
      else trace[trace.length - 1].right = x = this.uptree(x, p, g);
    }
  }

  insert(key, value) {
    if (!this.root) return this.root = new Node(key, value);
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur = trace[trace.length - 1];
    if (key < cur.key) trace.push(cur.left = new Node(key, value));
    else trace.push(cur.right = new Node(key, value));
    this.splay(trace);
  }

  join(tree) {
    if (!this.root) return this.root = tree.root;
    var trace = [this.root];
    var cur = this.root;
    while (cur.right) trace.push(cur = cur.right);
    this.splay(trace);
    this.root.right = tree.root;
    this.root.update();
  }

  remove(key) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    if (trace[trace.length - 1].key != key) return;
    this.splay(trace);
    var tree = new SplayTree(this.root.right);
    this.root = this.root.left;
    this.join(tree);
  }

  update(key, value) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur.value = value;
    this.splay(trace);
  }

  res() {
    if (!this.root) return 0;
    return (this.root.max - this.root.min - this.root.maxGap) || 0
  }

  print() {
    return;
    console.log(this.root ? this.root.toString() : undefined);
  }
}

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

let inputString = '';
let currentLine = 0;

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

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

    C();
});

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

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        let a = ti(readline().split(' '));

        let isReverseSorted = true;
        let allSame = true;
        for(let i = 1; i < n; i++){
            if(a[i] !== a[i-1]){
                allSame = false;
            }

            if(a[i] > a[i-1]){
                isReverseSorted = false;
                break;
            }
        }

        if(isReverseSorted){
            if(!allSame)
                console.log('No');
            else
                console.log('Yes');
        }else{
            console.log('Yes');
        }
    }
}

function C(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let [n, q] = ti(readline().split(' '));
        let a = ti(readline().split(' '));

        let dp = new Array(n);
        for(let i = 0; i < n; i++)
            dp[i] = new Array(2);

        let maxPos = a[0];
        let maxNeg = 0;
        for(let i = 1; i < n; i++){
            dp[i][0] = maxNeg + a[i];
            dp[i][1] = maxPos - a[i];

            maxPos = Math.max(maxPos, dp[i][0]);
            maxNeg = Math.max(maxNeg, dp[i][1]);
        }

        console.log(Math.max(maxPos, maxNeg));
    }
}

function solv() {
    var ip = readline().split(' ').map(x => parseInt(x))

    var x = ip[0]
    var y = ip[1]

    var s = readline().split(' ').map(x => parseInt(x))

    var a = [s[0]]
    var b = [0]

    for (var n = 1; n < x; n++) {
        var p = b[n - 1] + s[n]
        var q = a[n - 1] - s[n]
        a.push(Math.max(a[n - 1], p))
        b.push(Math.max(b[n - 1], q))
    }

    print(Math.max(a[x - 1], b[x - 1]))
}

var tc = 1;
tc = parseInt(readline());
while (tc--) solv()

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

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var N = nextInt();
    var list = nextIntArray();
    var index = -1;
    for(var j = 0; j < N; j++){
      if(list[j] == N){
        index = j;
        break;
      }
    }
    var max = 0;
    for(var j = 1; j < N - 1; j++){
      if(list[j] > list[j + 1] && list[j - 1] < list[j]){
        max += list[j];
      }
      if(list[j] < list[j + 1] && list[j - 1] > list[j]){
        max -= list[j];
      }
    }
    if(N >= 2){
      if(list[0] > list[1]){
        max += list[0];
      }
      if(list[N - 1] > list[N - 2]){
        max += list[N - 1];
      }
    }

    output[i] = max;
  }
  myout(myconv(output, 9));
}

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    if (n == 1) {
      console.log(a[0]);
      return;
    }
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    cong[1] = a[1];
    tru[1] = Math.max(0, a[0] - a[1])
    for (let i = 2; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(cong[n - 1]);
  }
})();

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    if (n == 1) {
      console.log(a[0]);
      continue;
    }
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    cong[1] = a[1];
    tru[1] = Math.max(0, a[0] - a[1])
    for (let i = 2; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(cong[n - 1]);
  }
})();

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    if (n == 1) {
      console.log(a[0]);
      return;
    }
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    cong[1] = a[1];
    for (let i = 2; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(Math.max(...cong));
  }
})();