This page is still under construction.

Parts of this page are still being built. What you see may change.

Binary Game

Time limit1sMemory limit256 MB

Summary
Read two binary strings and decide whether the first can reach the second by deleting the front character or appending the current parity bit.
Level

Medium6 of 10

Topics
Queue, Math
Solved
No attempts yet

Problem

Junmin was fishing with his friends Jaehyun and Sunyoung. Three hours passed without a single catch, so the other two got bored and started a binary game to tease him.

Jaehyun and Sunyoung write two strings aa and bb made only of 0 and 1, then hand them to Junmin. Junmin wins if he turns aa into bb. He may use the following two operations any number of times, in any order.

  • He can remove the first character of aa. For example, 1001 becomes 001. When aa is empty, nothing can be removed.
  • He can append parity(aa) to the end of aa. For example, 1000 becomes 10001. parity(aa) is 1 when the number of 1s in aa is odd, and 0 otherwise.

Junmin is bad at this game, so he asks whether he can win. Write a program that reads aa and bb and decides whether Junmin can win.

Input

The first line has the string aa and the second line has the string bb. Both strings consist only of 0 and 1, and the length of each string is between 1 and 1,000.

Output

Print VICTORY if Junmin can win, and DEFEAT otherwise.

Examples2

  1. Example 1

    Input
    01011
    0110
    
    Expected output
    VICTORY
    
  2. Example 2

    Input
    0011
    1110
    
    Expected output
    DEFEAT