There are n cities in Cyberland, numbered from 1 to n, connected by m bidirectional roads. The j-th road connects city aj and bj.

For tourists, souvenirs are sold in every city of Cyberland. In particular, city i sell it at a price of wi.

Now there are q queries for you to handle. There are two types of queries:

  * "C a w": The price in city a is changed to w.
  * "A a b": Now a tourist will travel from city a to b. He will choose a route, he also doesn't want to visit a city twice. He will buy souvenirs at the city where the souvenirs are the cheapest (possibly exactly at city a or b). You should output the minimum possible price that he can buy the souvenirs during his travel.



More formally, we can define routes as follow:

  * A route is a sequence of cities [x1, x2, ..., xk], where k is a certain positive integer.
  * For any 1 ≤ i < j ≤ k, xi ≠ xj.
  * For any 1 ≤ i < k, there is a road connecting xi and xi + 1.
  * The minimum price of the route is min(wx1, wx2, ..., wxk).
  * The required answer is the minimum value of the minimum prices of all valid routes from a to b.

Input

The first line of input contains three integers n, m, q (1 ≤ n, m, q ≤ 105), separated by a single space.

Next n lines contain integers wi (1 ≤ wi ≤ 109).

Next m lines contain pairs of space-separated integers aj and bj (1 ≤ aj, bj ≤ n, aj ≠ bj).

It is guaranteed that there is at most one road connecting the same pair of cities. There is always at least one valid route between any two cities.

Next q lines each describe a query. The format is "C a w" or "A a b" (1 ≤ a, b ≤ n, 1 ≤ w ≤ 109).

Output

For each query of type "A", output the corresponding answer.

Examples

Input

3 3 3
1
2
3
1 2
2 3
1 3
A 2 3
C 1 5
A 2 3


Output

1
2


Input

7 9 4
1
2
3
4
5
6
7
1 2
2 5
1 5
2 3
3 4
2 4
5 6
6 7
5 7
A 2 3
A 6 4
A 6 7
A 3 3


Output

2
1
5
3

Note

For the second sample, an optimal routes are:

From 2 to 3 it is [2, 3].

From 6 to 4 it is [6, 5, 1, 2, 4].

From 6 to 7 it is [6, 5, 7].

From 3 to 3 it is [3].

<image>
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T &x, T y) {
  x = x > y ? x : y;
}
template <typename T>
void chkmin(T &x, T y) {
  x = x < y ? x : y;
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= f;
}
const int N = 200010;
int n, m, l, q, cnt, tim, tot, d[N], f[N], st[N], dfn[N], num[N], low[N],
    top[N], siz[N], son[N], val[N], head[N];
vector<int> E[N];
struct Edge {
  int next, num;
} e[N * 5];
struct Heap {
  priority_queue<int, vector<int>, greater<int> > h1, h2;
  int top() {
    while (!h2.empty() && h1.top() == h2.top()) h1.pop(), h2.pop();
    return h1.top();
  }
  void push(int x) { h1.push(x); }
  void erase(int x) { h2.push(x); }
} h[N];
struct SegmentTree {
  int mn[N * 4];
  void update(int k) { mn[k] = min(mn[k << 1], mn[k << 1 | 1]); }
  void build(int k, int l, int r) {
    if (l == r) {
      mn[k] = num[l] > n ? h[num[l]].top() : val[num[l]];
      return;
    }
    int mid = (l + r) >> 1;
    build(k << 1, l, mid), build(k << 1 | 1, mid + 1, r);
    update(k);
  }
  void modify(int k, int l, int r, int x, int v) {
    if (l == r) return mn[k] = v, void();
    int mid = (l + r) >> 1;
    if (x <= mid)
      modify(k << 1, l, mid, x, v);
    else
      modify(k << 1 | 1, mid + 1, r, x, v);
    update(k);
  }
  int query(int k, int l, int r, int L, int R) {
    if (L <= l && r <= R) return mn[k];
    int mid = (l + r) >> 1, ret = INT_MAX;
    if (L <= mid) chkmin(ret, query(k << 1, l, mid, L, R));
    if (R > mid) chkmin(ret, query(k << 1 | 1, mid + 1, r, L, R));
    return ret;
  }
} T;
void add(int x, int y) { e[++cnt] = (Edge){head[x], y}, head[x] = cnt; }
void tarjan(int x) {
  dfn[x] = low[x] = ++tim, st[++l] = x;
  for (int i = 0; i < E[x].size(); i++) {
    int k = E[x][i];
    if (!dfn[k]) {
      tarjan(k), chkmin(low[x], low[k]);
      if (low[k] == dfn[x]) {
        ++tot, add(x, tot), add(tot, x);
        for (int y = 0; y != k; l--)
          y = st[l], add(st[l], tot), add(tot, st[l]);
      }
    } else
      chkmin(low[x], dfn[k]);
  }
}
void dfs1(int x, int fa) {
  siz[x] = 1, f[x] = fa, d[x] = d[fa] + 1;
  for (int p = head[x]; p; p = e[p].next) {
    int k = e[p].num;
    if (k == fa) continue;
    dfs1(k, x), siz[x] += siz[k];
    if (siz[k] > siz[son[x]]) son[x] = k;
    if (x > n) h[x].push(val[k]);
  }
}
void dfs2(int x, int tp) {
  top[x] = tp, dfn[x] = ++tim, num[tim] = x;
  if (!son[x]) return;
  dfs2(son[x], tp);
  for (int p = head[x]; p; p = e[p].next) {
    int k = e[p].num;
    if (k == f[x] || k == son[x]) continue;
    dfs2(k, k);
  }
}
int main() {
  read(n), read(m), read(q);
  tot = n;
  for (int i = 1; i <= n; i++) read(val[i]);
  for (int i = 1; i <= m; i++) {
    int x, y;
    read(x), read(y);
    E[x].push_back(y), E[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tim = l = 0, tarjan(i);
  memset(dfn, 0, sizeof(dfn));
  tim = 0;
  dfs1(1, 0), dfs2(1, 1), T.build(1, 1, tot);
  while (q--) {
    char c = getchar();
    while (!isalpha(c)) c = getchar();
    int x, y;
    read(x), read(y);
    if (c == 'C') {
      T.modify(1, 1, tot, dfn[x], y);
      if (f[x]) {
        h[f[x]].erase(val[x]), val[x] = y, h[f[x]].push(y);
        T.modify(1, 1, tot, dfn[f[x]], h[f[x]].top());
      } else
        val[x] = y;
    } else {
      int fx = top[x], fy = top[y], ret = INT_MAX;
      while (fx != fy) {
        if (d[fx] < d[fy]) swap(fx, fy), swap(x, y);
        chkmin(ret, T.query(1, 1, tot, dfn[fx], dfn[x]));
        x = f[fx], fx = top[x];
      }
      if (d[x] > d[y]) swap(x, y);
      chkmin(ret, T.query(1, 1, tot, dfn[x], dfn[y]));
      if (x > n) chkmin(ret, val[f[x]]);
      cout << ret << "\n";
    }
  }
  return 0;
}
