import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
for (int i = 0; i <= n; i++) {
String str = scn.next();
if(reduntantparanthesis(str)) {
System.out.println("Duplicate");
}
else {
System.out.println("Not Duplicates");
}
}
}
public static boolean reduntantparanthesis(String str) {
Stack<Character> stack = new Stack<>();
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == ')') {
char top = stack.peek();
stack.pop();
int operands = 0;
while (top != '(') {
operands++;
top=stack.peek();
stack.pop();
}
if (operands<1) {
return true;
}
}
else {
stack.push(str.charAt(i));
}
}
return false;
}
}