Induced subgraphs

Given an undirected graph G=(V,E)G = (V, E), any S⊆VS \subseteq V induces a subgraph G[S]=(S,E′)G[S] = (S, E'), where E′E' contains all edges in EE that join two vertices in SS. Let d(S)d(S) denote the minimum degree of the vertices in G[S]G[S].

You are given a graph GG and a size ss. Which is the maximum degree dd for which there exists some SS with at least ss vertices and such that d(S)≥dd(S) \ge d?

Input

Input consists of several cases, each with the number of vertices nn, the number of edges mm, and mm pairs xyx \enspace y (with x≠yx \ne y), one for each edge of the graph, followed by ss. The vertices are numbered from 0 to n−1n - 1. Assume 1≤n≤1031 \le n \le 10^3, 0≤m≤n(n−1)/20 \le m \le n(n - 1)/2, that there are no repeated edges, and 1≤s≤n1 \le s \le n.

Output

For every case, print the required answer.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:01:20.593Z

© Jutge.org, 2006–2026.
https://jutge.org