#include <bits/stdc++.h>
using namespace std;
int main() {
  char input[1000002];
  bool memo[1000002];
  int a, b, len;
  long long x, expo;
  for (int i = 0; i <= 1000000; i++) {
    memo[i] = false;
  }
  scanf("%s", input);
  scanf("%d %d", &a, &b);
  len = strlen(input);
  x = 0ll;
  for (int i = 0; i <= len - 2; i++) {
    x = (long long)(x * 10) + (input[i] - '0');
    x %= (long long)a;
    if ((x == 0) && (input[i + 1] != '0')) {
      memo[i] = true;
    }
  }
  expo = 1;
  x = 0ll;
  for (int i = len - 1; i >= 1; i--) {
    x = (long long)x + ((input[i] - '0') * expo);
    expo *= 10;
    x %= (long long)b;
    expo %= (long long)b;
    if ((x == 0) && (input[i] != '0') && (memo[i - 1])) {
      printf("YES\n");
      for (int j = 0; j <= i - 1; j++) printf("%c", input[j]);
      puts("");
      for (int j = i; j <= len - 1; j++) printf("%c", input[j]);
      return 0;
    }
  }
  printf("NO");
  return 0;
}
