#include <bits/stdc++.h>
using namespace std;
const int MAX = 1.5e7 + 10;
const int N = 3e5 + 10;
int v[N];
int vis[MAX], cnt[MAX];
const double pi = 3.14159265358979323846;
int main() {
  string s;
  cin >> s;
  long long a, b;
  cin >> a >> b;
  int n = s.size();
  vector<long long> pf(n);
  pf[0] = (s[0] - '0') % a;
  for (int i = 1; i < n; i++)
    pf[i] = ((pf[i - 1] * 10) % a + (s[i] - '0') % a) % a;
  vector<long long> sf(n);
  sf[n - 1] = (s[n - 1] - '0') % b;
  long long ten = 10;
  for (int i = n - 2; i >= 0; i--) {
    sf[i] = ((ten * (s[i] - '0')) % b + sf[i + 1] % b) % b;
    ten = (ten * 10) % b;
  }
  int an = -1;
  for (int i = 0; i < n - 1; i++) {
    if (pf[i] == 0 && sf[i + 1] == 0 && s[i + 1] != '0') an = i;
  }
  if (an == -1 || s[0] == 0) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 0; i <= an; i++) cout << s[i];
  cout << endl;
  for (int i = an + 1; i < n; i++) cout << s[i];
}
