#include <iostream>
#include <vector>
using namespace std;
const int MAX_N = 300005;
int bridgec;
vector<int> adj [MAX_N];
int lvl [MAX_N];
int dp [MAX_N];
void visit (int vertex) {
dp[vertex] = 0;
vector<int> temp;
int par = 0;
int child = 0;
for (int nxt : adj[vertex])
{
if (lvl[nxt] == 0)
{ /* edge to child */
child++;
if (!temp.empty())
{
temp[temp.size() - 1] -= par;
par = 0;
}
lvl[nxt] = lvl[vertex] + 1;
visit(nxt);
dp[vertex] += dp[nxt];
temp.push_back(dp[nxt]);
}
else if (lvl[nxt] < lvl[vertex])
{ /* edge upwards */
dp[vertex]++;
}
else if (lvl[nxt] > lvl[vertex])
{ /* edge downwards */
dp[vertex]--;
par++;
}
}
/* the parent edge isn't a back-edge, subtract 1 to compensate */
dp[vertex]--;
//Special Cases
if (child == 0)
return;//leave node
if (vertex == 1)
{
// root node
if (child > 1)
{
cout << "vertex " << vertex << endl;
bridgec++;
}
return;
}
//General Cases
temp[temp.size() - 1] -= par;
int flag = 0;
for (int x : temp)
{
if (x != 0) continue;
else {
flag = 1;
}
}
if (flag)
{
cout << "vertex " << vertex << endl;
bridgec++;
}
}
int main () {
/* problem statement: given a connected graph. calculate the number of articulation points. */
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int vertexc, edgec;
cin >> vertexc >> edgec;
for (int i = 0; i < edgec; i++) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
lvl[1] = 1;
visit(1);
cout << bridgec << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhfTiA9IDMwMDAwNTsKCmludCBicmlkZ2VjOwp2ZWN0b3I8aW50PiBhZGogW01BWF9OXTsKCmludCBsdmwgW01BWF9OXTsKaW50IGRwIFtNQVhfT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