package main
import (
"bufio"
"fmt"
"os"
)
func ask(in *bufio.Reader, out *bufio.Writer, op string, a int) int {
fmt.Fprintf(out, "%s %d\n", op, a)
out.Flush()
var res int
if _, err := fmt.Fscan(in, &res); err != nil {
os.Exit(0)
}
if res == -1 {
os.Exit(0)
}
return res
}
func answer(out *bufio.Writer, x int) {
fmt.Fprintf(out, "C %d\n", x)
out.Flush()
}
func main() {
in := bufio.NewReaderSize(os.Stdin, 1<<20)
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
var n int
fmt.Fscan(in, &n)
comp := make([]bool, n+1)
primes := make([]int, 0)
for i := 2; i <= n; i++ {
if !comp[i] {
primes = append(primes, i)
if i*i <= n {
for j := i * i; j <= n; j += i {
comp[j] = true
}
}
}
}
split := 0
for split < len(primes) && primes[split]*primes[split] <= n {
split++
}
ans := 1
remain := n
for i := 0; i < split; i++ {
p := primes[i]
b := ask(in, out, "B", p)
a := ask(in, out, "A", p)
if a > 0 {
cur := p
for cur <= n/p {
next := cur * p
if ask(in, out, "A", next) > 0 {
cur = next
} else {
break
}
}
ans *= cur
remain -= b - 1
} else {
remain -= b
}
}
block := 100
for i := split; i < len(primes); i += block {
end := i + block
if end > len(primes) {
end = len(primes)
}
for j := i; j < end; j++ {
remain -= ask(in, out, "B", primes[j])
}
real := ask(in, out, "A", 1)
if real != remain {
for j := i; j < end; j++ {
if ask(in, out, "A", primes[j]) > 0 {
ans *= primes[j]
answer(out, ans)
return
}
}
}
}
answer(out, ans)
}