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, nn, m, q;
int w[100010];
int head[100010 * 2], tot;
struct edge {
  int v, next, flag;
} ed[100010 * 4];
int dfn[100010], low[100010], idx, st[100010], top;
pair<int, int> E[100010 * 10];
int Tmp[100010];
int cutoradd[100010 * 2];
map<int, int> num[100010 * 2];
void add(int u, int v) {
  ed[tot].v = v;
  ed[tot].flag = 0;
  ed[tot].next = head[u];
  head[u] = tot++;
}
void tarjan(int u, int fa) {
  int i, j, v, son = 0;
  dfn[u] = low[u] = ++idx;
  for (i = head[u]; ~i; i = ed[i].next) {
    v = ed[i].v;
    if (ed[i].flag || dfn[v] >= dfn[u]) continue;
    ed[i].flag = ed[i ^ 1].flag = 1;
    st[++top] = i;
    if (dfn[v] == -1) {
      son++;
      tarjan(v, u);
      low[u] = min(low[u], low[v]);
      if (dfn[u] <= low[v]) {
        if (u != fa) cutoradd[u] = 1;
        n++;
        cutoradd[n] = 1;
        do {
          j = st[top--];
          if (Tmp[ed[j].v] != n) {
            E[m++] = make_pair(n, ed[j].v);
            Tmp[ed[j].v] = n;
          }
          if (Tmp[ed[j ^ 1].v] != n) {
            E[m++] = make_pair(n, ed[j ^ 1].v);
            Tmp[ed[j ^ 1].v] = n;
          }
        } while (j != i);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
  if (u == fa && son > 1) cutoradd[u] = 1;
}
void bcc() {
  memset(dfn, -1, sizeof(dfn));
  idx = top = 0;
  for (int i = 1; i <= nn; i++) {
    if (dfn[i] == -1) tarjan(i, i);
  }
}
int belong[100010 * 2];
void build() {
  memset(head, -1, sizeof(head));
  tot = 0;
  for (int i = 0; i < m; i++) {
    int u = E[i].first;
    int v = E[i].second;
    add(u, v);
    add(v, u);
  }
  for (int i = 1; i <= n; i++) {
    num[i][2000000000]++;
    if (cutoradd[i]) {
      belong[i] = i;
      if (i <= nn)
        num[i][w[i]]++;
      else
        for (int j = head[i]; ~j; j = ed[j].next) {
          int v = ed[j].v;
          if (!cutoradd[v]) {
            num[i][w[v]]++;
            belong[v] = i;
          }
        }
    }
  }
}
struct node {
  int l, r, mn;
} f[100010 * 8];
void init(int l, int r, int i) {
  f[i].l = l;
  f[i].r = r;
  f[i].mn = 2000000000;
  if (l == r) return;
  int mid = ((l + r) >> 1);
  init(l, mid, (i << 1));
  init(mid + 1, r, ((i << 1) | 1));
}
void update(int pos, int i, int key) {
  if (pos == f[i].l && f[i].l == f[i].r) {
    f[i].mn = key;
    return;
  }
  int mid = ((f[i].l + f[i].r) >> 1);
  if (pos <= mid)
    update(pos, (i << 1), key);
  else
    update(pos, ((i << 1) | 1), key);
  f[i].mn = min(f[(i << 1)].mn, f[((i << 1) | 1)].mn);
}
int query(int l, int r, int i) {
  if (l == f[i].l && r == f[i].r) return f[i].mn;
  int mid = ((f[i].l + f[i].r) >> 1);
  if (r <= mid)
    return query(l, r, (i << 1));
  else if (l > mid)
    return query(l, r, ((i << 1) | 1));
  else
    return min(query(l, mid, (i << 1)), query(mid + 1, r, ((i << 1) | 1)));
}
int dep[100010 * 2], pre[100010 * 2], size[100010 * 2], hson[100010 * 2],
    Top[100010 * 2], tid[100010 * 2], ftid[100010 * 2];
void dfs1(int u, int fa) {
  dep[u] = dep[fa] + 1;
  pre[u] = fa;
  size[u] = 1;
  for (int i = head[u]; ~i; i = ed[i].next) {
    int v = ed[i].v;
    if (v != fa && cutoradd[v]) {
      dfs1(v, u);
      size[u] += size[v];
      if (size[v] > size[hson[u]]) hson[u] = v;
      if (u > nn) num[u][w[v]]++;
    }
  }
}
void dfs2(int u, int tp) {
  Top[u] = tp;
  tid[u] = idx;
  ftid[idx] = u;
  update(idx, 1, (*(num[u].begin())).first);
  idx++;
  if (hson[u]) dfs2(hson[u], tp);
  for (int i = head[u]; ~i; i = ed[i].next) {
    int v = ed[i].v;
    if (v != hson[u] && v != pre[u] && cutoradd[v]) dfs2(v, v);
  }
}
void ask(int u, int v) {
  int fu = Top[u], fv = Top[v];
  int ans = 2000000000;
  while (fu != fv) {
    if (dep[fu] < dep[fv]) {
      swap(fu, fv);
      swap(u, v);
    }
    ans = min(ans, query(tid[fu], tid[u], 1));
    u = pre[fu];
    fu = Top[u];
  }
  if (dep[u] > dep[v]) swap(u, v);
  ans = min(ans, query(tid[u], tid[v], 1));
  u = pre[u];
  if (u && u <= nn) ans = min(ans, query(tid[u], tid[u], 1));
  printf("%d\n", ans);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  nn = n;
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  memset(head, -1, sizeof(head));
  tot = 0;
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  m = 0;
  bcc();
  build();
  init(1, n, 1);
  idx = 1;
  for (int i = 1; i <= n; i++) {
    if (cutoradd[i]) {
      dfs1(i, 0);
      dfs2(i, i);
      break;
    }
  }
  while (q--) {
    int u, v;
    char op[5];
    scanf("%s%d%d", op, &u, &v);
    if (op[0] == 'C') {
      num[belong[u]][w[u]]--;
      if (num[belong[u]][w[u]] == 0) num[belong[u]].erase(w[u]);
      if (cutoradd[u] && pre[u]) {
        num[pre[u]][w[u]]--;
        if (num[pre[u]][w[u]] == 0) num[pre[u]].erase(w[u]);
      }
      w[u] = v;
      num[belong[u]][v]++;
      update(tid[belong[u]], 1, (*num[belong[u]].begin()).first);
      if (cutoradd[u] && pre[u]) {
        num[pre[u]][v]++;
        update(tid[pre[u]], 1, (*num[pre[u]].begin()).first);
      }
    } else {
      if (u == v)
        printf("%d\n", w[u]);
      else
        ask(belong[u], belong[v]);
    }
  }
  return 0;
}
