{"task": {"agent_timeout": 600, "task": "111", "verifier_timeout": 7200, "instruction": "Please implement a Python 3 solution to the below problem.\nReason through the problem and:\n1. Restate the problem in plain English\n2. Conceptualize a solution first in plain English\n3. Write a pseudocode solution\n4. Save your solution as solution.py\nNo outside libraries are allowed.\n\n[BEGIN PROBLEM]\nProblem 3: Bovine Alliance [Mark Gordon, 2011]\n\nBessie and her bovine pals from nearby farms have finally decided that they\nare going to start connecting their farms together by trails in an effort\nto form an alliance against the farmers.  The cows in each of the N (1 <= N\n<= 100,000) farms were initially instructed to build a trail to exactly one\nother farm, for a total of N trails.  However months into the project only\nM (1 <= M < N) of these trails had actually been built.\n\nArguments between the farms over which farms already built a trail now\nthreaten to split apart the cow alliance.  To ease tension, Bessie wishes\nto calculate how many ways the M trails that exist so far could have been\nbuilt.  For example, if there is a trail connecting farms 3 and 4, then one\npossibility is that farm 3 built the trail, and the other possibility is\nthat farm 4 built the trail.  Help Bessie by calculating the number of\ndifferent assignments of trails to the farms that built them, modulo\n1,000,000,007.  Two assignments are considered different if there is at\nleast one trail built by a different farm in each assignment.\n\nPROBLEM NAME: alliance\n\nINPUT FORMAT:\n\n* Line 1: Two space-separated integers N and M\n\n* Lines 2..1+M: Line i+1 describes the ith trail.  Each line contains\n        two space-separated integers u_i and v_i (1 <= u_i, v_i <= N,\n        u_i != v_i) describing the pair of farms connected by the\n        trail.\n\nSAMPLE INPUT:\n\n5 4\n1 2\n3 2\n4 5\n4 5\n\nINPUT DETAILS:\n\nNote that there can be two trails between the same pair of farms.\n\nOUTPUT FORMAT:\n\n* Line 1: A single line containing the number of assignments of trails\n        to farms, taken modulo 1,000,000,007.  If no assignment\n        satisfies the above conditions output 0.\n\nSAMPLE OUTPUT:\n\n6\n\nOUTPUT DETAILS:\n\nThere are 6 possible assignments.  Letting {a,b,c,d} mean that farm 1\nbuilds trail a, farm 2 builds trail b, farm 3 builds trail c, and farm 4\nbuilds trail d, the assignments are:\n{2, 3, 4, 5}\n{2, 3, 5, 4}\n{1, 3, 4, 5}\n{1, 3, 5, 4}\n{1, 2, 4, 5}\n{1, 2, 5, 4}\n\n[END PROBLEM]\n", "memory": "2048m", "runnable": false, "difficulty": "medium", "language": "", "cpus": 1, "instruction_truncated": false, "category": "python_programming", "compose": false, "has_solution": true, "oracle": null, "docker_image": "", "taskset": "usaco", "tags": ["python", "programming", "usaco"]}, "runs": []}