Johnny is playing a well-known computer game. The game are in some country, where the player can freely travel, pass quests and gain an experience.

In that country there are n islands and m bridges between them, so you can travel from any island to any other. In the middle of some bridges are lying ancient powerful artifacts. Johnny is not interested in artifacts, but he can get some money by selling some artifact.

At the start Johnny is in the island a and the artifact-dealer is in the island b (possibly they are on the same island). Johnny wants to find some artifact, come to the dealer and sell it. The only difficulty is that bridges are too old and destroying right after passing over them. Johnnie's character can't swim, fly and teleport, so the problem became too difficult.

Note that Johnny can't pass the half of the bridge, collect the artifact and return to the same island. 

Determine if Johnny can find some artifact and sell it.

Input

The first line contains two integers n and m (1 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of islands and bridges in the game.

Each of the next m lines contains the description of the bridge — three integers xi, yi, zi (1 ≤ xi, yi ≤ n, xi ≠ yi, 0 ≤ zi ≤ 1), where xi and yi are the islands connected by the i-th bridge, zi equals to one if that bridge contains an artifact and to zero otherwise. There are no more than one bridge between any pair of islands. It is guaranteed that it's possible to travel between any pair of islands.

The last line contains two integers a and b (1 ≤ a, b ≤ n) — the islands where are Johnny and the artifact-dealer respectively.

Output

If Johnny can find some artifact and sell it print the only word "YES" (without quotes). Otherwise print the word "NO" (without quotes).

Examples

Input

6 7
1 2 0
2 3 0
3 1 0
3 4 1
4 5 0
5 6 0
6 4 0
1 6


Output

YES


Input

5 4
1 2 0
2 3 0
3 4 0
2 5 1
1 4


Output

NO


Input

5 6
1 2 0
2 3 0
3 1 0
3 4 0
4 5 1
5 3 0
1 2


Output

YES
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int N = 3e5 + 10;
int n, m, st, en, w[N], v[N][2];
vector<int> e[N];
vector<pair<int, int> > v2[N];
int low[N], num[N], t[N], br[N];
queue<int> q;
int good[N], t2[N];
void prepare() {
  scanf("%d%d", &n, &m);
  int x, y;
  for (auto i = (1); i <= (m); i++) {
    scanf("%d%d%d", &x, &y, w + i);
    e[x].push_back(i);
    e[y].push_back(i);
    v[i][0] = x;
    v[i][1] = y;
  }
  scanf("%d%d", &st, &en);
}
void DFS(int x, int le) {
  static int top = 0;
  low[x] = num[x] = ++top;
  for (auto i : e[x])
    if (i != le) {
      int y = v[i][0] + v[i][1] - x;
      if (!num[y]) {
        t[y] = i;
        DFS(y, i);
      }
      low[x] = min(low[x], low[y]);
    }
}
void BFS(int st) {
  static int n1 = 0;
  num[st] = ++n1;
  q.push(st);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (auto i : e[x])
      if (!br[i]) {
        int y = v[i][0] + v[i][1] - x;
        if (w[i]) good[n1] = 1;
        if (!num[y]) {
          num[y] = n1;
          q.push(y);
        }
      }
  }
}
int solve() {
  DFS(st, 0);
  for (auto i = (1); i <= (n); i++)
    if (low[i] >= num[i]) br[t[i]] = 1;
  memset(num, 0, sizeof(num));
  for (auto i = (1); i <= (n); i++)
    if (!num[i]) BFS(i);
  for (auto i = (1); i <= (m); i++)
    if (br[i]) {
      int x = num[v[i][0]], y = num[v[i][1]];
      v2[x].push_back(pair<int, int>(y, w[i]));
      v2[y].push_back(pair<int, int>(x, w[i]));
    }
  st = num[st], en = num[en];
  q.push(st);
  memset(t2, -1, sizeof(t2));
  t2[st] = good[st];
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (auto i : v2[x])
      if (t2[i.first] == -1) {
        t2[i.first] = t2[x] | i.second | good[i.first];
        q.push(i.first);
      }
  }
  return t2[en];
}
int main() {
  prepare();
  if (solve())
    cout << "YES";
  else
    cout << "NO";
}
