#include <bits/stdc++.h>
const long long md = 1e9 + 7;
using namespace std;
long long a, b;
int n;
map<int, int> mpa;
map<int, int> mpb;
void div_by_b(string sp) {
  int tid = n - 1;
  long long x = 0;
  long long mul = 1;
  while (tid >= 0) {
    x = x + (sp[tid] - '0') * 1ll * mul;
    x = x % b;
    mul = (mul * 10) % b;
    if ((x == 0) && (sp[tid] != '0')) mpb[tid] = 1;
    tid--;
  }
}
void div_by_a(string sp) {
  int tid = 0;
  long long x = 0;
  while (tid < n) {
    x = x * 10 + (sp[tid] - '0');
    x = x % a;
    if (x == 0) mpa[tid] = 1;
    tid++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string sp;
  cin >> sp;
  long long tmp;
  cin >> a >> b;
  n = sp.length();
  div_by_b(sp);
  div_by_a(sp);
  bool ck = true;
  for (int j = 0; j < n; j++) {
    if ((mpa[j] == 1) && (mpb[j + 1])) {
      cout << "YES"
           << "\n";
      for (int i = 0; i < j + 1; i++) cout << sp[i];
      cout << "\n";
      for (int i = j + 1; i < n; i++) cout << sp[i];
      cout << "\n";
      ck = false;
      break;
    }
  }
  if (ck)
    cout << "NO"
         << "\n";
  return 0;
}
