```go
package main
import (
"bufio"
"fmt"
"os"
)
func gcd(a, b int64) int64 {
for b != 0 {
a, b = b, a%b
}
return a
}
func rev(n int64) int64 {
var r int64
for n > 0 {
r = r*10 + n%10
n /= 10
}
return r
}
type Sig struct {
u, v int64
}
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var maxX, maxY, w int64
fmt.Fscan(reader, &maxX, &maxY, &w)
limit := maxX
if maxY > limit {
limit = maxY
}
sigID := make([]int, limit+1)
sigMap := make(map[Sig]int)
nextID := 0
for i := int64(1); i <= limit; i++ {
r := rev(i)
g := gcd(i, r)
s := Sig{i / g, r / g}
id, ok := sigMap[s]
if !ok {
id = nextID
sigMap[s] = id
nextID++
}
sigID[i] = id
}
compID := make([]int, nextID)
for s, id := range sigMap {
compS := Sig{s.v, s.u}
if cID, ok := sigMap[compS]; ok {
compID[id] = cID
} else {
compID[id] = -1
}
}
cntX := make([]int64, nextID)
cntY := make([]int64, nextID)
for i := int64(1); i <= maxY; i++ {
cntY[sigID[i]]++
}
var bestX, bestY int64 = -1, -1
var minArea int64 = -1
var currW int64 = 0
y := maxY
for x := int64(1); x <= maxX; x++ {
s := sigID[x]
c := compID[s]
if c != -1 {
currW += cntY[c]
}
cntX[s]++
for y > 0 {
yS := sigID[y]
yC := compID[yS]
loss := int64(0)
if yC != -1 {
loss = cntX[yC]
}
if currW-loss >= w {
currW -= loss
cntY[yS]--
y--
} else {
break
}
}
if currW >= w {
area := x * y
if minArea == -1 || area < minArea {
minArea = area
bestX = x
bestY = y
}
}
}
if minArea != -1 {
fmt.Fprintln(writer, bestX, bestY)
} else {
fmt.Fprintln(writer, -1)
}
}
```