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>
const int Max = 1e5 + 10;
using namespace std;
struct edge {
  int to;
  int next;
};
struct heap {
  priority_queue<int, vector<int>, greater<int> > add, del;
  int getMin() {
    while (!add.empty() && !del.empty() && add.top() == del.top()) {
      add.pop();
      del.pop();
    }
    return add.top();
  }
  void insert(int x) { add.push(x); }
  void remove(int x) {
    if (add.top() == x) {
      add.pop();
    } else {
      del.push(x);
    }
  }
  bool empty() { return add.size() - del.size() > 0; }
} point[Max << 1];
vector<int> e[Max], g[Max << 1];
int tree[Max << 3], val[Max << 1];
int head[Max], head1[Max << 1], dfn[Max << 1], rDfn[Max << 1], low[Max << 1],
    son[Max << 1], hTop[Max << 1], size[Max << 1], fa[Max << 1], dep[Max << 1];
int s[Max];
int cnt = 0, cnt1 = 0, timing = 0, top = -1, all;
int n, m, q;
void dfs(int u) {
  son[u] = 0;
  size[u] = 1;
  for (int v : g[u]) {
    if (!dep[v]) {
      dep[v] = dep[u] + 1;
      fa[v] = u;
      dfs(v);
      size[u] += size[v];
      if (size[v] > size[son[u]]) {
        son[u] = v;
      }
    }
  }
}
void linkCut(int u, int top) {
  hTop[u] = top;
  dfn[u] = ++timing;
  rDfn[timing] = u;
  if (!son[u]) {
    return;
  }
  linkCut(son[u], top);
  for (int v : g[u]) {
    if (v != son[u] && v != fa[u]) {
      linkCut(v, v);
    }
  }
}
void tarjan(int u) {
  dfn[u] = low[u] = ++timing;
  s[++top] = u;
  for (int v : e[u]) {
    if (!dfn[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
      if (dfn[u] == low[v]) {
        ++all;
        for (int t = 0; t != v; top--) {
          t = s[top];
          g[all].push_back(t);
          g[t].push_back(all);
        }
        g[all].push_back(u);
        g[u].push_back(all);
      }
    } else {
      low[u] = min(low[u], dfn[v]);
    }
  }
}
void pushUp(int k) { tree[k] = min(tree[k << 1], tree[k << 1 | 1]); }
void build(int k, int l, int r) {
  if (l == r) {
    tree[k] = val[rDfn[l]];
    return;
  }
  int mid = (l + r) >> 1;
  build(k << 1, l, mid), build(k << 1 | 1, mid + 1, r);
  pushUp(k);
}
void update(int k, int l, int r, int u, int x) {
  if (l == r) {
    tree[k] = x;
    return;
  }
  int mid = (l + r) >> 1;
  if (u <= mid)
    update(k << 1, l, mid, u, x);
  else
    update(k << 1 | 1, mid + 1, r, u, x);
  pushUp(k);
}
int query(int k, int l, int r, int ql, int qr) {
  int ans1 = 0x7fffffff, ans2 = 0x7fffffff;
  if (ql <= l && r <= qr) {
    return tree[k];
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) {
    ans1 = min(ans1, query(k << 1, l, mid, ql, qr));
  }
  if (qr > mid) {
    ans2 = min(ans2, query(k << 1 | 1, mid + 1, r, ql, qr));
  }
  return min(ans1, ans2);
}
void modify(int u, int x) {
  int mn;
  update(1, 1, all, dfn[u], x);
  if (fa[u]) {
    point[fa[u]].remove(val[u]);
    point[fa[u]].insert(x);
    mn = point[fa[u]].getMin();
    if (val[fa[u]] != mn) {
      val[fa[u]] = mn;
      update(1, 1, all, dfn[fa[u]], val[fa[u]]);
    }
  }
  val[u] = x;
}
int solve(int u, int v) {
  int ans = 0x7fffffff;
  while (hTop[u] != hTop[v]) {
    if (dep[hTop[u]] < dep[hTop[v]]) {
      swap(u, v);
    }
    ans = min(ans, query(1, 1, all, dfn[hTop[u]], dfn[u]));
    u = fa[hTop[u]];
  }
  if (dep[u] > dep[v]) {
    swap(u, v);
  }
  ans = min(ans, query(1, 1, all, dfn[u], dfn[v]));
  if (u > n) {
    ans = min(ans, val[fa[u]]);
  }
  return ans;
}
int main() {
  int u, v, k, x, y;
  char op[2];
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &val[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  all = n;
  for (int i = 1; i <= n; i++) {
    if (!dfn[i]) {
      tarjan(i);
      top = -1;
    }
  }
  timing = 0;
  dep[1] = 1;
  dfs(1);
  linkCut(1, 1);
  for (int i = 1; i <= n; i++) {
    if (fa[i]) {
      point[fa[i]].insert(val[i]);
    }
  }
  for (int i = n + 1; i <= all; i++) {
    val[i] = point[i].getMin();
  }
  build(1, 1, all);
  for (int i = 1; i <= q; i++) {
    scanf("%s", op);
    if (op[0] == 'C') {
      scanf("%d%d", &u, &k);
      modify(u, k);
    } else {
      scanf("%d%d", &u, &v);
      printf("%d\n", solve(u, v));
    }
  }
  return 0;
}
