#pragma comment(linker, "/STACK:102400000,102400000") //#include #include #include #include #include #include #include #include #include #define fi first #define se second #define endl '\n' #define o2(x) (x)*(x) #define BASE_MAX 31 #define mk make_pair #define eb push_back #define SZ(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define clr(a, b) memset((a),(b),sizeof((a))) #define iis std::ios::sync_with_stdio(false); cin.tie(0) #define my_unique(x) sort(all(x)),x.erase(unique(all(x)),x.end()) using namespace std; #pragma optimize("-O3") typedef long long LL; typedef unsigned long long uLL; typedef pair pii; inline LL read() { LL x = 0;int f = 0; char ch = getchar(); while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar(); while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); return x = f ? -x : x; } inline void write(LL x, bool f) { if (x == 0) {putchar('0'); if(f)putchar('\n');else putchar(' ');return;} if (x < 0) {putchar('-');x = -x;} static char s[23]; int l = 0; while (x != 0)s[l++] = x % 10 + 48, x /= 10; while (l)putchar(s[--l]); if(f)putchar('\n');else putchar(' '); } int lowbit(int x) { return x & (-x); } templateT big(const T &a1, const T &a2) { return a1 > a2 ? a1 : a2; } templateT sml(const T &a1, const T &a2) { return a1 < a2 ? a1 : a2; } templateT big(const T &f, const R &...r) { return big(f, big(r...)); } templateT sml(const T &f, const R &...r) { return sml(f, sml(r...)); } void debug_out() { cerr << '\n'; } templatevoid debug_out(const T &f, const R &...r) {cerr << f << " ";debug_out(r...);} #define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__); const LL INFLL = 0x3f3f3f3f3f3f3f3fLL; const int HMOD[] = {1000000009, 1004535809}; const LL BASE[] = {1572872831, 1971536491}; const int mod = 1e9 + 7;//998244353 const int MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const int MXN = 1e3 + 7; const int MXE = 1e6 + 7; int n, m, k; int ar[MXN], du[MXN], is[MXN], fa[MXN]; int main() { int tim = read(); while(tim --) { n = read(), m = read(), k = read(); for(int i = 1; i <= n; ++i) du[i] = 0; for(int i = 1, a, b; i <= m; ++i) { a = read(), b = read(); du[a] ++, du[b] ++; } if(k * (n - 1) < m) { printf("No\n"); continue; } int flag = 1; for(int i = 1; i <= n; ++i) { if(du[i] < k) flag = 0; } if(flag) printf("Yes\n"); else printf("No\n"); } return 0; }