#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, p, q;
char s[N];
int a[N], b[N];
int main() {
  scanf("%s", s);
  scanf("%d%d", &p, &q);
  n = strlen(s);
  for (int i = 0; i < n; ++i) {
    a[i + 1] = (10LL * a[i] + (s[i] - '0')) % p;
  }
  for (int i = n - 1, x = 1; i; --i) {
    b[i] = (1LL * x * (s[i] - '0') + b[i + 1]) % q;
    x = 10LL * x % q;
  }
  for (int i = 0; i + 1 < n; ++i)
    if (!a[i + 1] && !b[i + 1] && s[i + 1] != '0') {
      printf("YES\n");
      for (int j = 0; j <= i; ++j) printf("%c", s[j]);
      printf("\n");
      for (int j = i + 1; j < n; ++j) printf("%c", s[j]);
      printf("\n");
      return 0;
    }
  puts("NO");
  return 0;
}
