#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
char num[maxn];
bool jud[maxn];
int main() {
  while (scanf("%s", num) != EOF) {
    int a, b;
    scanf("%d %d", &a, &b);
    memset(jud, 0, sizeof(jud));
    int len = strlen(num);
    int cur = 0;
    for (int i = 0; i < len; i++) {
      cur *= 10;
      cur += num[i] - '0';
      cur %= a;
      if (cur == 0 && i < len - 1 && num[i + 1] != '0') jud[i] = true;
    }
    bool ok = false;
    int k = 1, pos;
    cur = 0;
    for (int i = len - 1; i >= 0; i--) {
      cur += (num[i] - '0') * k;
      cur %= b;
      if (cur == 0 && jud[i - 1] && num[i] != '0') {
        ok = true;
        pos = i;
        break;
      }
      k *= 10;
      k %= b;
    }
    if (ok) {
      printf("YES\n");
      for (int i = 0; i < pos - 1; i++) printf("%c", num[i]);
      printf("%c\n", num[pos - 1]);
      for (int i = pos; i < len - 1; i++) printf("%c", num[i]);
      printf("%c\n", num[len - 1]);
    } else
      printf("NO\n");
  }
  return 0;
}
