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;
const int mod = 1000 * 1000 * 1000 + 7;
const int INF = 1e9 + 100;
const long long LINF = 1e18 + 100;
const int MAXN = 200100;
const int LOGN = 25;
int n, m, q;
int a[MAXN];
vector<int> adj[MAXN];
bool mark[MAXN];
int h[MAXN];
vector<int> stk;
vector<int> bct[MAXN];
int cn;
int head[MAXN];
int sttime[MAXN], timer, revst[MAXN];
int lpar[LOGN][MAXN];
int subtree[MAXN];
int seg[4 * MAXN];
priority_queue<int, vector<int>, greater<int>> ads[MAXN], rms[MAXN];
inline void addedge(int x, int y) {
  bct[x].push_back(y);
  bct[y].push_back(x);
}
int dfs1(int v, int par) {
  mark[v] = true;
  int dp = h[v];
  stk.push_back(v);
  for (int u : adj[v]) {
    if (!mark[u]) {
      h[u] = h[v] + 1;
      dp = min(dp, dfs1(u, v));
    } else
      dp = min(dp, h[u]);
  }
  if (par > 0 && dp == h[par]) {
    cn++;
    while (true) {
      int u = stk.back();
      stk.pop_back();
      addedge(u, n + cn);
      if (u == v) break;
    }
    addedge(par, n + cn);
  }
  if (par < 0) stk.clear();
  return dp;
}
void dfs2(int v) {
  subtree[v] = 1;
  for (int u : bct[v])
    if (u != lpar[0][v]) {
      lpar[0][u] = v;
      dfs2(u);
      subtree[v] += subtree[u];
    }
}
void dfs3(int v) {
  sttime[v] = timer++;
  revst[sttime[v]] = v;
  int big = 0;
  for (int u : bct[v])
    if (u != lpar[0][v] && subtree[u] > subtree[big]) big = u;
  if (big) {
    head[big] = head[v];
    dfs3(big);
    for (int u : bct[v])
      if (u != lpar[0][v] && u != big) head[u] = u, dfs3(u);
  }
}
void build(int v = 1, int l = 0, int r = MAXN - 1) {
  if (l == r) {
    seg[v] = (ads[revst[l]].empty() ? INF : ads[revst[l]].top());
    return;
  }
  int mid = (r + l) / 2;
  build(2 * v, l, mid);
  build(2 * v + 1, mid + 1, r);
  seg[v] = min(seg[2 * v], seg[2 * v + 1]);
}
void setind(int i, int x, int v = 1, int l = 0, int r = MAXN - 1) {
  if (l == r) {
    seg[v] = x;
    return;
  }
  int mid = (r + l) / 2;
  if (i <= mid)
    setind(i, x, 2 * v, l, mid);
  else
    setind(i, x, 2 * v + 1, mid + 1, r);
  seg[v] = min(seg[2 * v], seg[2 * v + 1]);
}
int get(int L, int R, int v = 1, int l = 0, int r = MAXN - 1) {
  if (l > R || r < L) return INF;
  if (l >= L && r <= R) return seg[v];
  int mid = (r + l) / 2;
  return min(get(L, R, 2 * v, l, mid), get(L, R, 2 * v + 1, mid + 1, r));
}
pair<int, int> process(int x, int y) {
  int res = INF;
  while (head[x] != head[y]) {
    if (sttime[head[x]] < sttime[head[y]]) swap(x, y);
    res = min(res, get(sttime[head[x]], sttime[x]));
    x = lpar[0][head[x]];
  }
  if (sttime[x] < sttime[y]) swap(x, y);
  res = min(res, get(sttime[y], sttime[x]));
  return {res, y};
}
int32_t main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> q;
  for (int i = (1); i < (n + 1); i++) cin >> a[i];
  for (int i = (0); i < (m); i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs1(1, -1);
  dfs2(n + 1);
  head[n + 1] = n + 1;
  dfs3(n + 1);
  for (int i = (1); i < (LOGN); i++)
    for (int j = (1); j < (MAXN); j++) lpar[i][j] = lpar[i - 1][lpar[i - 1][j]];
  for (int i = (1); i < (n + 1); i++) ads[lpar[0][i]].push(a[i]);
  ;
  ;
  ;
  ;
  ;
  ;
  build();
  while (q--) {
    char op;
    int x, y;
    cin >> op >> x >> y;
    if (op == 'C') {
      int p = lpar[0][x];
      rms[p].push(a[x]);
      a[x] = y;
      ads[p].push(y);
      while (!rms[p].empty() && ads[p].top() == rms[p].top())
        ads[p].pop(), rms[p].pop();
      setind(sttime[p], ads[p].top());
    } else {
      pair<int, int> p = process(x, y);
      int ans = p.first, l = p.second;
      if (l <= n)
        ans = min(ans, a[l]);
      else if (lpar[0][l])
        ans = min(ans, a[lpar[0][l]]);
      cout << ans << '\n';
    }
  }
  return 0;
}
