have crushed Razor and presently, you are the Most Wanted road racer. Sergeant Cross has sent the full police power after you in a destructive pursuit. Luckily, you have discovered a concealing spot however you dread that Cross and his power will ultimately discover you. To build your odds of endurance, you need to tune

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Correct answer will be upvoted else downvoted.

 

you have crushed Razor and presently, you are the Most Wanted road racer. Sergeant Cross has sent the full police power after you in a destructive pursuit. Luckily, you have discovered a concealing spot however you dread that Cross and his power will ultimately discover you. To build your odds of endurance, you need to tune and repaint your BMW M3 GTR. 

 

The vehicle can be envisioned as a permuted n-dimensional hypercube. A straightforward n-dimensional hypercube is an undirected unweighted chart assembled recursively as follows: 

 

Take two basic (n−1)- dimensional hypercubes one having vertices numbered from 0 to 2n−1−1 and the other having vertices numbered from 2n−1 to 2n−1. A basic 0-dimensional Hypercube is only a solitary vertex. 

 

Add an edge between the vertices I and i+2n−1 for each 0≤i<2n−1. 

 

A permuted n-dimensional hypercube is shaped by permuting the vertex numbers of a straightforward n-dimensional hypercube in any self-assertive way. 

Input :The primary line of input contains a solitary integer t (1≤t≤4096) — the number of experiments. For each experiment, the main line contains a solitary integer n (1≤n≤16). Each of the following n⋅2n−1 lines contain two integers u and v (0≤u,v<2n) meaning that there is an edge between the vertices numbered u and v. 

It is ensured that the chart depicted in the input is a permuted n-dimensional hypercube. Furthermore, it is ensured that the amount of 2n over all experiments doesn't surpass 216=65536. 

Output :For each experiment, print two lines. In the principal line, output any stage P of length 2n that can be utilized to change a straightforward n-dimensional hypercube to the permuted n-dimensional hypercube given in the input. Two permuted hypercubes are viewed as something similar on the off chance that they have similar arrangement of edges. In case there are numerous replies, output any of them. 

In the subsequent line, print the shading. In case it is absolutely impossible to shading the vertices fulfilling the conditions, output −1. In any case, output a solitary line containing 2n space isolated integers. The I-th integer should be the shade of the vertex numbered (i−1) in the permuted n-dimensional hypercube. In case there are numerous replies, output any of them.

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY