/* my output dublicate but Editorial answer is Not Dublicate for ((a-b+c)+((a+d)+(d+e))+((f+d)+(f+e))) this Exp . and i thing my answer is right .*/
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
String str = sc.nextLine();
boolean result = findDuplicateparenthesis(str);
if(result == true){
System.out.println("Not Duplicates");
}else{
System.out.println("Duplicate");
}
}
}
static boolean findDuplicateparenthesis(String s) {
// create a stack of characters
Stack<Character> Stack = new Stack<>();
// Iterate through the given expression
char[] str = s.toCharArray();
for (char ch : str) {
// if current character is close parenthesis ')'
if (ch == ')') {
// pop character from the stack
char top = Stack.peek();
Stack.pop();
// stores the number of characters between a
// closing and opening parenthesis
// if this count is less than or equal to 1
// then the brackets are redundant else not
int elementsInside = 0;
while (top != '(') {
elementsInside++;
top = Stack.peek();
Stack.pop();
}
if (elementsInside < 1) {
return true;
}
} // push open parenthesis '(', operators and
// operands to stack
else {
Stack.push(ch);
}
}
// No duplicates found
return false;
}
}