3 5
2 1 608591421 720962564
3 2 608591421 641991574
3 2 718110706 353409763
2 3 482786015 858341723
3 2 825397574 357507279
 2 1
2 1 317425595 636156322
 50000 1
20845 28516 904146168 997637433

Yes
641991574 1
2 
 Yes
0 0

 Yes
0 0


#include <bits/stdc++.h>
using namespace std;
int main() {
  int cities, roads;
  cin >> cities >> roads;
  int test[roads][4];
  int destructcount = 0;
  int destroytime[roads];
  int destroyroads[roads];
  for (int i = 0; i < roads; i++) {
    destroyroads[i] = 0;
    destroytime[i] = 0;
    for (int j = 0; j < 4; j++) cin >> test[i][j];
  }
  for (int i = 0; i < roads; i++) {
    for (int j = i + 1; j < roads; j++) {
      if (test[i][0] == test[j][1] and test[i][1] == test[j][0] and
          test[i][2] == test[j][2]) {
        destructcount++;
        if (test[i][3] < test[j][3]) {
          destroytime[i] = test[i][3];
          destroyroads[i] = i + 1;
        } else {
          destroytime[j] = test[j][3];
          destroyroads[j] = j + 1;
        }
      }
    }
  }
  int highest = 0;
  for (int i = 0; i < roads; i++) {
    if (destroytime[i] > highest) highest = destroytime[i];
  }
  if (destructcount == 0) {
    cout << "No" << endl;
    return 0;
  } else
    cout << "Yes" << endl;
  cout << highest << " " << destructcount << endl;
  for (int i = 0; i < roads; i++) {
    if (destroyroads[i] > 0) {
      cout << destroyroads[i] << " ";
    }
  }
  cout << endl;
}
