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 N = 1e5 + 10, M = 2e5 + 10;
const int INF = 0x3f3f3f3f;
int n;
int w[M];
struct Edge {
  int to, ne;
};
int head[N], cnt;
Edge edge[N * 2];
void add(int u, int v) {
  edge[++cnt].to = v, edge[cnt].ne = head[u], head[u] = cnt;
}
int he[M], cc;
Edge ed[M * 2];
void readd(int u, int v) { ed[++cc].to = v, ed[cc].ne = he[u], he[u] = cc; }
multiset<int> bival[N];
int tot;
int dfn[N], tim, low[N];
stack<int> stk;
void tarjan(int x) {
  low[x] = dfn[x] = ++tim;
  stk.push(x);
  for (int i = head[x]; i; i = edge[i].ne) {
    int v = edge[i].to;
    if (!dfn[v]) {
      tarjan(v);
      low[x] = min(low[x], low[v]);
      if (low[v] >= dfn[x]) {
        tot++;
        int y;
        do {
          y = stk.top(), stk.pop();
          readd(y, tot), readd(tot, y);
        } while (y != v);
        readd(x, tot), readd(tot, x);
      }
    } else
      low[x] = min(low[x], dfn[v]);
  }
}
int minn[M << 2];
int wt[M];
void build(int l, int r, int root) {
  if (l == r) {
    minn[root] = wt[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, (root << 1));
  build(mid + 1, r, (root << 1 | 1));
  minn[root] = min(minn[(root << 1)], minn[(root << 1 | 1)]);
}
void update(int l, int r, int root, int point, int val) {
  if (l == r) {
    minn[root] = val;
    return;
  }
  int mid = (l + r) >> 1;
  if (point <= mid)
    update(l, mid, (root << 1), point, val);
  else
    update(mid + 1, r, (root << 1 | 1), point, val);
  minn[root] = min(minn[(root << 1)], minn[(root << 1 | 1)]);
}
int query(int a, int b, int l, int r, int root) {
  if (a <= l && r <= b) return minn[root];
  int mid = (l + r) >> 1;
  int ans = INF;
  if (a <= mid) ans = min(ans, query(a, b, l, mid, (root << 1)));
  if (b > mid) ans = min(ans, query(a, b, mid + 1, r, (root << 1 | 1)));
  return ans;
}
int deep[M], siz[M], son[M], fa[M], top[M];
int idcnt, id[M];
void dfs1(int x) {
  siz[x] = 1, deep[x] = deep[fa[x]] + 1;
  for (int i = he[x]; i; i = ed[i].ne) {
    int v = ed[i].to;
    if (v == fa[x]) continue;
    fa[v] = x;
    dfs1(v);
    siz[x] += siz[v];
    if (siz[son[x]] < siz[v]) son[x] = v;
  }
}
void dfs2(int x, int topp) {
  id[x] = ++idcnt;
  wt[idcnt] = w[x];
  top[x] = topp;
  if (son[x]) dfs2(son[x], topp);
  for (int i = he[x]; i; i = ed[i].ne) {
    int v = ed[i].to;
    if (v != fa[x] && v != son[x]) dfs2(v, v);
  }
}
int qRange(int x, int y) {
  int ans = INF;
  while (top[x] != top[y]) {
    if (deep[top[x]] < deep[top[y]]) swap(x, y);
    ans = min(ans, query(id[top[x]], id[x], 1, idcnt, 1));
    x = fa[top[x]];
  }
  if (deep[x] < deep[y]) swap(x, y);
  ans = min(ans, query(id[y], id[x], 1, idcnt, 1));
  if (y > n) ans = min(ans, w[fa[y]]);
  return ans;
}
void solve_update(int x, int newval) {
  int oldval = w[x];
  w[x] = newval;
  update(1, idcnt, 1, id[x], newval);
  if (x == 1) return;
  int ff = fa[x] - n;
  bival[ff].erase(bival[ff].find(oldval));
  bival[ff].insert(newval);
  int newmin = *bival[ff].begin();
  if (newmin != w[fa[x]]) {
    w[fa[x]] = newmin;
    update(1, idcnt, 1, id[fa[x]], newmin);
  }
}
int main(int argc, char const *argv[]) {
  int m, q, u, v;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) cin >> w[i];
  while (m--) {
    cin >> u >> v;
    add(u, v), add(v, u);
  }
  tot = n;
  tarjan(1);
  dfs1(1);
  for (int i = 2; i <= n; i++) bival[fa[i] - n].insert(w[i]);
  for (int i = n + 1; i <= tot; i++)
    w[i] = bival[i - n].empty() ? INF : *bival[i - n].begin();
  dfs2(1, 1);
  build(1, idcnt, 1);
  char c;
  int a, b;
  while (q--) {
    cin >> c >> a >> b;
    if (c == 'C')
      solve_update(a, b);
    else
      cout << qRange(a, b) << endl;
  }
  return 0;
}
