Associated Course(s):
DSA-Self Paced with Doubt Assistance
Placement 100

Given an undirected graph and an edge, the task is to find if the given edge is a bridge in graph, i.e., removing the edge disconnects the graph.

**Input:**

The first line of the input contains an integer **'T'** denoting the number of test cases. Then **'T'** test cases follow. Each test case consists of two lines.

Description of test cases is as follows:

The First line of each test case contains two integers **'N' and 'M' ** which denotes the no of vertices and no of edges respectively.

The Second line of each test case contains **'M' ** space separated pairs **u** and **v** denoting that there is a bidirectional edge from **u** to **v**

The third line contains two space seperated integers denoting the edge to be removed.

**Output:**

For each test case ouput a single line 1 or 0, 1 if edge is a Bridge edge or not.

**Constraints:**

1<=T<=50

1<=N,M<=100

**Example:**

**Input:**

2

4 3

0 1 1 2 2 3

1 2

5 5

1 2 2 0 1 0 3 4 3 0

2 0

**Ouput:**

1

0

**Note:**The **Input/Ouput** format and **Example** given are used for system's internal purpose, and should be used by a user for **Expected Output** only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

sabka_din_aayega | 317 |

maggiiiii | 248 |

thanuvinu94 | 211 |

Savage_19 | 206 |

Anugrah_kumar | 172 |

Bishnu Dev Panda | 803 |

sabka_din_aayega | 628 |

Anugrah_kumar | 562 |

okayboss | 561 |

maggiiiii | 531 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.