#include <bits/stdc++.h>
using namespace std;
vector<long long int> num;
const long long int INF = 600000000;
const int MAX = 1000010;
int f[MAX], e[MAX];
void print(string a, int b) {
  for (int i = 0; i <= b; i++) {
    cout << a[i];
  }
  cout << endl;
  for (int i = b + 1; i < a.size(); i++) {
    cout << a[i];
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int a, b;
  cin >> a >> b;
  int cur = 0;
  for (int i = 0; i < s.size(); i++) {
    int now = int(s[i]) - '0';
    cur = 10 * cur + now;
    cur %= a;
    f[i] = cur;
  }
  cur = 0;
  int last = 1;
  for (int i = s.size() - 1; i >= 0; i--) {
    int now = int(s[i]) - '0';
    cur = last * now + cur;
    cur %= b;
    e[i] = cur;
    last = last * 10;
    last %= b;
  }
  for (int i = 0; i < s.size() - 1; i++) {
    char st1 = s[0];
    char st2 = s[i + 1];
    if (st1 != '0' and st2 != '0') {
      if (f[i] == 0 and e[i + 1] == 0) {
        cout << "YES\n";
        print(s, i);
        return 0;
      }
    }
  }
  cout << "NO\n";
}
