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;
int n, m, Q, w[400010], cnt, dfn[400010], low[400010], tot, blo[400010];
int fa[400010], top[400010], pos[400010], po[400010], dep[400010], size[400010],
    nxt[400010];
int k, la[400010], ff[400010], tp, q[400010], flag[400010];
struct node {
  int a, b;
} e[400010];
struct info {
  int x, y;
  bool operator<(const info &p) const { return y > p.y; }
};
struct data {
  int minn;
} t[400010 * 4];
vector<int> s[400010];
priority_queue<info> h[400010];
void add(int a, int b) {
  e[++k] = (node){a, b};
  ff[k] = la[a];
  la[a] = k;
  e[++k] = (node){b, a};
  ff[k] = la[b];
  la[b] = k;
}
void insert(int x, int p) {
  if (blo[x] == p) return;
  s[p].push_back(x);
  blo[x] = p;
}
void dfs(int x, int pre) {
  dfn[x] = ++cnt;
  low[x] = cnt;
  for (int a = la[x]; a; a = ff[a]) {
    if (!dfn[e[a].b]) {
      q[++tp] = a;
      dfs(e[a].b, x);
      low[x] = min(low[x], low[e[a].b]);
      if (low[e[a].b] >= dfn[x]) {
        tot++;
        for (; tp; tp--) {
          insert(e[q[tp]].a, tot);
          insert(e[q[tp]].b, tot);
          if (q[tp] == a) {
            tp--;
            break;
          }
        }
      }
    } else if (dfn[e[a].b] < dfn[x] && e[a].b != pre) {
      q[++tp] = a;
      low[x] = min(low[x], dfn[e[a].b]);
    }
  }
}
void solve() {
  k = 0;
  memset(la, 0, sizeof(la));
  for (int i = 1; i <= tot; i++)
    for (int j = 0; j < s[i].size(); j++) add(n + i, s[i][j]);
}
void bfs() {
  int l = 1, r = 2;
  q[1] = 1;
  dep[1] = 1;
  cnt = 0;
  while (l < r) {
    int x = q[l++];
    size[x] = 1;
    for (int a = la[x]; a; a = ff[a]) {
      if (dep[e[a].b]) continue;
      q[r] = e[a].b;
      fa[q[r]] = x;
      dep[q[r]] = dep[x] + 1;
      r++;
    }
  }
  for (int i = 1; i <= n; i++)
    if (fa[i]) h[fa[i]].push((info){i, w[i]});
  for (int i = r - 1; i; i--) {
    int x = q[i];
    if (!fa[x]) continue;
    size[fa[x]] += size[x];
    if (size[nxt[fa[x]]] < size[x]) nxt[fa[x]] = x;
  }
  for (int i = 1; i < r; i++) {
    int x = q[i];
    if (top[x]) continue;
    for (int j = x; j; j = nxt[j]) top[j] = x, po[pos[j] = ++cnt] = j;
  }
}
int get(int x) {
  if (x <= n) return w[x];
  while (1) {
    info p = h[x].top();
    if (w[p.x] == p.y) return p.y;
    h[x].pop();
  }
}
class seg_tree {
 public:
  void build(int x, int l, int r) {
    if (l == r) {
      t[x].minn = get(po[l]);
      return;
    }
    int mid = l + r >> 1, lc = x << 1, rc = lc + 1;
    build(lc, l, mid);
    build(rc, mid + 1, r);
    t[x].minn = min(t[lc].minn, t[rc].minn);
  }
  int qry(int x, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) return t[x].minn;
    int mid = l + r >> 1, lc = x << 1, rc = lc + 1, res = 2100000000;
    if (ql <= mid) res = min(res, qry(lc, l, mid, ql, qr));
    if (qr > mid) res = min(res, qry(rc, mid + 1, r, ql, qr));
    return res;
  }
  void modify(int x, int l, int r, int pos, int a, int b) {
    if (l == r) {
      if (po[l] > n) h[po[l]].push((info){a, b});
      t[x].minn = get(po[l]);
      return;
    }
    int mid = l + r >> 1, lc = x << 1, rc = lc + 1;
    if (pos <= mid)
      modify(lc, l, mid, pos, a, b);
    else
      modify(rc, mid + 1, r, pos, a, b);
    t[x].minn = min(t[lc].minn, t[rc].minn);
  }
} T;
int qry(int x, int y) {
  int res = 2100000000;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    res = min(res, T.qry(1, 1, cnt, pos[top[x]], pos[x]));
    x = fa[top[x]];
  }
  if (pos[x] > pos[y]) swap(x, y);
  res = min(res, T.qry(1, 1, cnt, pos[x], pos[y]));
  if (x > n) res = min(res, w[fa[x]]);
  return res;
}
int main() {
  int a, b;
  char ch;
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= m; i++) scanf("%d%d", &a, &b), add(a, b);
  dfs(1, 0);
  solve();
  bfs();
  T.build(1, 1, cnt);
  while (Q--) {
    scanf(" %c%d%d", &ch, &a, &b);
    if (ch == 'A')
      printf("%d\n", qry(a, b));
    else {
      if (w[a] == b) continue;
      w[a] = b;
      T.modify(1, 1, cnt, pos[a], a, b);
      T.modify(1, 1, cnt, pos[fa[a]], a, b);
    }
  }
  return 0;
}
