#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<vector>
#include<stack>
#include<string>
using namespace std;
#define lson l,m,x<<1
#define rson m+1,r,x<<1|1

const int INF = 0x3fffffff;
const int dy[3] = { 3, 3, 3 };
const int dx[3] = { 0, 1, -1 };//
const double eps = 1e-8;
const int maxn = 666;

struct NODE {
	int x, y, step;
}st;
int mapn[3][102];
bool vis[3][102];
int n, k;

bool v(NODE a) {
	if (vis[a.x][a.y] == 1) {
		return 0;
	}
	else {
		vis[a.x][a.y] = 1;
		return 1;
	}
}

bool isValid(NODE a, int ud) {
	if (a.x < 0) return 0;
	if (a.x >= 3) return 0;
	if (mapn[a.x][a.y] == 1) return 0;
	if (mapn[a.x][a.y - 1] == 1) return 0;
	if (mapn[a.x][a.y - 2] == 1) return 0;
	//if (mapn[a.x][a.y - 3] == 1) return 0;
	if (ud == 1) {
		if (mapn[a.x - 1][a.y - 2] == 1) return 0;
	}
	if (ud == 2) {
		if (mapn[a.x + 1][a.y - 2] == 1) return 0;
	}
	return 1;
}

int bfs(NODE st) {
	st.step = 0;
	queue<NODE> q;
	q.push(st);
	v(st);
	while (!q.empty()) {
		NODE cur = q.front();
		q.pop();
		if (cur.y >= n - 1) return cur.step;
		for (int i = 0; i < 3; i++) {
			NODE nex = { cur.x + dx[i], cur.y + dy[i], cur.step + 1 };
			if (isValid(nex, i) && v(nex)) {
				q.push(nex);
			}
		}
	}
	return 0;
}

int main() {
	//ios::sync_with_stdio(false);
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int t;
	cin >> t;
	while (t--) {
		cin >> n >> k;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < n; j++) {
				char ch;
				cin >> ch;
				if (ch == 's') {
					mapn[i][j] = 2;
					st.x = i;
					st.y = j;
				}
				else if (ch == '.') {
					mapn[i][j] = 0;
				}
				else {
					mapn[i][j] = 1;
				}
			}
		}
		memset(vis, 0, sizeof(vis));
		int ans = bfs(st);
		string y = "YES";
		string n = "NO";
		cout << (ans ? y : n) << endl;
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<vector>
#include<stack>
#include<string>
using namespace std;
#define lson l,m,x<<1
#define rson m+1,r,x<<1|1

const int INF = 0x3fffffff;
const int dy[3] = { 3, 3, 3 };
const int dx[3] = { 0, 1, -1 };//
const double eps = 1e-8;
const int maxn = 666;

struct NODE {
	int x, y, step;
}st;
int mapn[3][102];
bool vis[3][102];
int n, k;

bool v(NODE a) {
	if (vis[a.x][a.y] == 1) {
		return 0;
	}
	else {
		vis[a.x][a.y] = 1;
		return 1;
	}
}

bool isValid(NODE a, int ud) {
	if (a.x < 0) return 0;
	if (a.x >= 3) return 0;
	if (mapn[a.x][a.y] == 1) return 0;
	if (mapn[a.x][a.y - 1] == 1) return 0;
	if (mapn[a.x][a.y - 2] == 1) return 0;
	//if (mapn[a.x][a.y - 3] == 1) return 0;
	if (ud == 1) {
		if (mapn[a.x - 1][a.y - 2] == 1) return 0;
	}
	if (ud == 2) {
		if (mapn[a.x + 1][a.y - 2] == 1) return 0;
	}
	return 1;
}

int bfs(NODE st) {
	st.step = 0;
	queue<NODE> q;
	q.push(st);
	v(st);
	while (!q.empty()) {
		NODE cur = q.front();
		q.pop();
		if (cur.y >= n - 1) return cur.step;
		for (int i = 0; i < 3; i++) {
			NODE nex = { cur.x + dx[i], cur.y + dy[i], cur.step + 1 };
			if (isValid(nex, i) && v(nex)) {
				q.push(nex);
			}
		}
	}
	return 0;
}

int main() {
	//ios::sync_with_stdio(false);
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int t;
	cin >> t;
	while (t--) {
		cin >> n >> k;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < n; j++) {
				char ch;
				cin >> ch;
				if (ch == 's') {
					mapn[i][j] = 2;
					st.x = i;
					st.y = j;
				}
				else if (ch == '.') {
					mapn[i][j] = 0;
				}
				else {
					mapn[i][j] = 1;
				}
			}
		}
		memset(vis, 0, sizeof(vis));
		memset(mapn, 0, sizeof(mapn));
		int ans = bfs(st);
		string y = "YES";
		string n = "NO";
		cout << (ans ? y : n) << endl;
	}
	return 0;
}


/*
Author : Arpit Saini
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(), (X).end()
#define loop(I, N) for (int I = 0; I < (N); ++I)
#define rep(I, A, B) for (int I = (A); I <= (B); ++I)
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define sii(X, Y) scanf("%d%d", &(X), &(Y))
#define siii(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define ss(X) scanf("%s", (X))
#define nl() printf("\n")
#define mp make_pair
#define pb push_back
#define ms0(X) memset((X), 0, sizeof((X)))
#define ms1(X) memset((X), -1, sizeof((X)))
#define len(X) strlen(X)
#define pii pair <int, int >
#define pll pair <ll , ll >
#define vi vector <int>
#define vpii vector < pii >
#define vpll vector < pll >
#define fi first
#define se second
#define type(X) __typeof(X.begin())
#define pi(n) printf("%d\n",n)
#define foreach(it,a) for(type(a) it=a.begin();it!=a.end();it++)
// Funtions
string tostring(int x){ostringstream o;o<<x;return o.str();}
int toint(string s){istringstream st(s);int i;st>>i;return i;}
// Constraints
const int mod = 1e9+7;
const int N = 1e2+10;
const int inf = 2e9;
const double eps = 1e-7;
const long long INF = (long long)1e18;

/* -------Template ends here-------- */

char a[3][N];
bool can[3][N];
int t,n,k;
bool Ok(int x,int y)
{
	return x>=0 && x<3 && y>=0 && y<n && a[x][y]>='A' && a[x][y]<='Z';
}
int main()
{
	si(t);
	while(t--)
	{
		sii(n,k);
		loop(i,3)ss(a);
		for(int i=0;i<=n;i++)can[0][i]=can[1][i]=can[2][i]=false;
		int x=0;
		for(int i=0;i<3;i++)if(a[0][i] == 's')x=i;
		can[x][0] = true;
		loop(i,n)
		{
			loop(j,3)
			{
				if(!can[j][i] || Ok(j,i + 2*i) || Ok(j , i+1 + 2*i)) // as train moves 2 times faster
					continue;
				for(int j1 = j-1;j1<=j+1;j1++)
				{
					if(j1 >=0 && j1<3 && !Ok(j1,i+1 + 2*i))
						can[j1][i+1] = true;
				}
			}
		}
		if(can[0][n] || can[1][n] || can[2][n])puts("YES");
		else puts("NO");
	}
	return 0;
}


/*
Author : Arpit Saini
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(), (X).end()
#define loop(I, N) for (int I = 0; I < (N); ++I)
#define rep(I, A, B) for (int I = (A); I <= (B); ++I)
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define sii(X, Y) scanf("%d%d", &(X), &(Y))
#define siii(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define ss(X) scanf("%s", (X))
#define nl() printf("\n")
#define mp make_pair
#define pb push_back
#define ms0(X) memset((X), 0, sizeof((X)))
#define ms1(X) memset((X), -1, sizeof((X)))
#define len(X) strlen(X)
#define pii pair <int, int >
#define pll pair <ll , ll >
#define vi vector <int>
#define vpii vector < pii >
#define vpll vector < pll >
#define fi first
#define se second
#define type(X) __typeof(X.begin())
#define pi(n) printf("%d\n",n)
#define foreach(it,a) for(type(a) it=a.begin();it!=a.end();it++)
// Funtions
string tostring(int x){ostringstream o;o<<x;return o.str();}
int toint(string s){istringstream st(s);int i;st>>i;return i;}
// Constraints
const int mod = 1e9+7;
const int N = 1e2+10;
const int inf = 2e9;
const double eps = 1e-7;
const long long INF = (long long)1e18;

/* -------Template ends here-------- */

char a[3][N];
bool can[3][N];
int t,n,k;
bool Ok(int x,int y)
{
	return x>=0 && x<3 && y>=0 && y<n && a[x][y]>='A' && a[x][y]<='Z';
}
int main()
{
	si(t);
	while(t--)
	{
		sii(n,k);
		loop(i,3)ss(a[i]);
		for(int i=0;i<=n;i++)can[0][i]=can[1][i]=can[2][i]=false;
		int x=-1;
		for(int i=0;i<3;i++)if(a[i][0] == 's')x=i;
		can[x][0] = true;
		loop(i,n)
		{
			loop(j,3)
			{
				if(!can[j][i] || Ok(j,i + 2*i) || Ok(j , i+1 + 2*i)) // as train moves 2 times faster
					continue;
				for(int j1 = j-1;j1<=j+1;j1++)
				{
					if(j1 >=0 && j1<3 && !Ok(j1,i+1 + 2*i))
						can[j1][i+1] = true;
				}
			}
		}
		if(can[0][n] || can[1][n] || can[2][n])puts("YES");
		else puts("NO");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define mp make_pair
#define MAX 1000006
#define mod 1000000007
#define pb push_back
#define INF 1e18
#define pii pair<int,int>

string s[5];
int vis[5][105];

void dfs(int a,int b,int n)
{
    vis[a][b]=1;
    int i;
    if(b+3>=n)
    {
        for(i=b;i<n;i++)
            if(s[a][i]!='.')
                break;
        if(i>=n)
            vis[a][n-1]=1;
        return;
    }
    if(a>0)
        if(s[a][b+1]=='.'&&s[a][b+2]=='.'&&s[a][b+3]=='.'&&s[a-1][b+3]=='.'&&!vis[a-1][b+3])
            dfs(a-1,b+3,n);
    if(s[a][b+1]=='.'&&s[a][b+2]=='.'&&s[a][b+3]=='.'&&!vis[a][b+3])
        dfs(a,b+3,n);
    if(a<2)
        if(s[a][b+1]=='.'&&s[a][b+2]=='.'&&s[a][b+3]=='.'&&s[a+1][b+3]=='.'&&!vis[a+1][b+3])
            dfs(a+1,b+3,n);
}

int main()
{
    //freopen ("input1.in","r",stdin);
    //freopen ("output22.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t,n,k,i;
    cin>>t;
    while(t--)
    {
        cin>>n>>k;
        for(i=0;i<3;i++)
            for(int j=0;j<n;j++)
                vis[i][j]=0;
        for(i=0;i<3;i++)
            cin>>s[i];
        for(i=0;i<3;i++)
            if(s[i][0]=='s')
                break;
        if(s[i][1]=='.')
        {
            if(i>0)
                dfs(i-1,1,n);
            dfs(i,1,n);
            if(i<2)
                dfs(i+1,1,n);
        }
        for(i=0;i<3;i++)
            if(vis[i][n-1])
                break;
        if(i==3)
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }

    return 0;
}


#include<bits/stdc++.h>
const int maxn=301,maxk=4;
char s[maxk][maxn];
int n,m;
bool arrived[maxk][maxn],ansgeted;
void init(){
    scanf("%d%*d",&n);m=3;
    for(int i=1;i<=3;i++){
        scanf("%s",s[i]+1);
        for(int j=1;j<=2;j++)
        s[i][n+j]='.';
    }
    memset(arrived,0,sizeof(arrived));
    ansgeted=0;
}
void dfs(int x,int y){
    if(ansgeted)return;
    if(arrived[x][y])return;
    arrived[x][y]=true;
    if(y>=n){ansgeted=true;return;}
    if(s[x][y+1]=='.'){
        if(s[x][y+2]=='.'&&s[x][y+3]=='.')dfs(x,y+3);
        if(x<3&&s[x+1][y+1]=='.'&&s[x+1][y+2]=='.'&&s[x+1][y+3]=='.')dfs(x+1,y+3);
        if(x>1&&s[x-1][y+1]=='.'&&s[x-1][y+2]=='.'&&s[x-1][y+3]=='.')dfs(x-1,y+3);
    }

}
void work(){
    for(int i=1;i<=m;i++)if(s[i][1]=='s')dfs(i,1);
    if(ansgeted)puts("YES");
    else puts("NO");
}
int main(){
    int t;scanf("%d",&t);
    while(t--)init(),work();
    return 0;
}


#include<bits/stdc++.h>
const int maxn=301,maxk=27;
char s[maxk][maxn];
int n,m;
bool arrived[maxk][maxn],ansgeted;
void init(){
    scanf("%d%*d",&n);m=3;
    for(int i=1;i<=3;i++)scanf("%s",s[i]+1);
    memset(arrived,0,sizeof(arrived));
    ansgeted=0;
}
void dfs(int x,int y){
    if(ansgeted)return;
    if(arrived[x][y])return;
    if(y>=n){ansgeted=true;return;}
    if(s[x][y+1]=='.'){
        if(s[x][y+2]=='.'&&s[x][y+3]=='.')dfs(x,y+3);
        if(x<m&&s[x+1][y+1]=='.'&&s[x+1][y+2]=='.'&&s[x+1][y+3]=='.')dfs(x+1,y+3);
        if(x>1&&s[x-1][y+1]=='.'&&s[x-1][y+2]=='.'&&s[x-1][y+3]=='.')dfs(x-1,y+3);
    }
    arrived[x][y]=true;
}
void work(){
    for(int i=1;i<=m;i++)if(s[i][1]=='s')dfs(i,1);
    if(ansgeted)puts("YES");
    else puts("NO");
}
int main(){
    int t;scanf("%d",&t);
    while(t--)init(),work();
    return 0;
}


#include<bits/stdc++.h>
const int maxn=101,maxk=27;
char s[maxk][maxn];
int n,m;
bool arrived[maxk][maxn],ansgeted;
void init(){
    scanf("%d%*d",&n);m=3;
    for(int i=1;i<=3;i++)scanf("%s",s[i]+1);
    memset(arrived,0,sizeof(arrived));
    ansgeted=0;
}
void dfs(int x,int y){
    if(ansgeted)return;
    if(arrived[x][y])return;
    if(y>=n){ansgeted=true;return;}
    if(s[x][y+1]=='.'){
        if(s[x][y+2]=='.'&&s[x][y+3]=='.')dfs(x,y+3);
        if(x<m&&s[x+1][y+1]=='.'&&s[x+1][y+2]=='.'&&s[x+1][y+3]=='.')dfs(x+1,y+3);
        if(x>1&&s[x-1][y+1]=='.'&&s[x-1][y+2]=='.'&&s[x-1][y+3]=='.')dfs(x-1,y+3);
    }
    arrived[x][y]=true;
}
void work(){
    for(int i=1;i<=m;i++)if(s[i][1]=='s')dfs(i,1);
    if(ansgeted)puts("YES");
    else puts("NO");
}
int main(){
    int t;scanf("%d",&t);
    while(t--)init(),work();
    return 0;
}


#include<bits/stdc++.h>
const int maxn=301,maxk=4;
char s[maxk][maxn];
int n,m;
bool arrived[maxk][maxn],ansgeted;
void init(){
    scanf("%d%*d",&n);m=3;
    for(int i=1;i<=3;i++){
        scanf("%s",s[i]+1);
        for(int j=1;j<=2;j++)
        s[n+j]='.';
    }
    memset(arrived,0,sizeof(arrived));
    ansgeted=0;
}
void dfs(int x,int y){
    if(ansgeted)return;
    if(arrived[x][y])return;
    arrived[x][y]=true;
    if(y>=n){ansgeted=true;return;}
    if(s[x][y+1]=='.'){
        if(s[x][y+2]=='.'&&s[x][y+3]=='.')dfs(x,y+3);
        if(x<3&&s[x+1][y+1]=='.'&&s[x+1][y+2]=='.'&&s[x+1][y+3]=='.')dfs(x+1,y+3);
        if(x>1&&s[x-1][y+1]=='.'&&s[x-1][y+2]=='.'&&s[x-1][y+3]=='.')dfs(x-1,y+3);
    }

}
void work(){
    for(int i=1;i<=m;i++)if(s[i][1]=='s')dfs(i,1);
    if(ansgeted)puts("YES");
    else puts("NO");
}
int main(){
    int t;scanf("%d",&t);
    while(t--)init(),work();
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;

int n,m,k,x,y,x1,x2,y1,y2;

int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>m>>k;
	bool used[100][100];
	int g[100][100];
	pair<int ,int > a[1000];
	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=m; j++){
			g[i][j] = 0;
		}
	}
	while(k--){
		cin>>x>>y;
		for(int i = 1; i<=2; i++){
			cin>>a[i].first>>a[i].second;
			used[a[i].first][a[i].second] = true;
			used[a[i].first+1][a[i].second]= true;
			used[a[i].first-1][a[i].second] = true;
			used[a[i].first][a[i].second-1] = true;
			used[a[i].first][a[i].second+1] = true;
		}
		if(used[x+1][y] == false || used[x-1][y] == false || used[x][y+1] == false || used[x][y-1] == false || x == 1 || y == 1 || x == m || y == n){
			cout<<"YES"<<endl;
		}
		else cout<<"NO"<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FI "tunnel.i2"
#define FO "tunnel.o2"

string s[3];
int cols, trains;
bool OK(int r, int c, bool bl){
    if (r < 0 || r > 2) return 0;
    if ( c >= cols) return 1;
    if (bl) return s[r][c] == '.' && s[r][c+1]=='.' && s[r][c+2] =='.' && OK(r,c+2,0);
    s[r][c] = 65;
    return s[r][c+1]=='.' && (OK(r-1,c+1,1) || OK(r, c+1,1) || OK(r+1, c+1, 1));
}

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    #ifndef ONLINE_JUDGE
    ifstream cin(FI);
    ofstream cout(FO);
    #endif // ONLINE_JUDGE
    int test, row;
    cin >> test;
    for(int t = 0; t < test; t++){
        cin >> cols >> trains;
        for(int i = 0; i < 3; i++){
            cin >> s[i];
            s[i][cols] = s[i][cols + 1] = '.';
            s[i][cols + 2] = 0;
            if(s[i][0] =='s') row = i;
        }
        if (OK(row,0,0)) cout << "YES\n"; else cout <<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FI "tunnel.i8"
#define FO "tunnel.o8"

string s[3];
int cols, trains;
bool OK(int r, int c, bool bl){
    if (r < 0 || r > 2) return 0;
    if ( c >= cols) return 1;
    if (bl) return s[r][c] == '.' && s[r][c+1]=='.' && s[r][c+2] =='.' && OK(r,c+2,0);
    s[r][c] = 65;
    return s[r][c+1]=='.' && (OK(r-1,c+1,1) || OK(r, c+1,1) || OK(r+1, c+1, 1));
}

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    #ifndef ONLINE_JUDGE
    ifstream cin(FI);
    ofstream cout(FO);
    #endif // ONLINE_JUDGE
    int test, row;
    cin >> test;
    for(int t = 0; t < test; t++){
        cin >> cols >> trains;
        for(int i = 0; i < 3; i++){
            cin >> s[i];
            s[i] += "..";
            //s[i][cols] = s[i][cols + 1] = '.';
            //s[i][cols + 2] = 0;
            if(s[i][0] =='s') row = i;
        }
        if (OK(row,0,0)) cout << "YES\n"; else cout <<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FI "tunnel.i2"
#define FO "tunnel.o2"

string s[3];
int cols, trains;
bool OK(int r, int c, bool bl){
    if (r < 0 || r > 2) return 0;
    if ( c >= cols) return 1;
    if (bl) return s[r][c] == '.' && s[r][c+1]=='.' && s[r][c+2] =='.' && OK(r,c+2,0);
    s[r][c] = 65;
    return s[r][c+1]=='.' && (OK(r-1,c+1,1) || OK(r, c+1,1) || OK(r+1, c+1, 1));
}

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    #ifndef ONLINE_JUDGE
    ifstream cin(FI);
    ofstream cout(FO);
    #endif // ONLINE_JUDGE
    int test, row;
    cin >> test;
    for(int t = 0; t < test; t++){
        cin >> cols >> trains;
        for(int i = 0; i < 3; i++){
            cin >> s[i];
            s[i][cols] = s[i][cols + 1] = '.';
            s[i][cols + 2] = 0;
            if(s[i][0] =='s') row = i;
        }
        if (f(row,0,0)) cout << "YES\n"; else cout <<"NO\n";
    }
    return 0;
}


#include<stdio.h>
int durum,flag,korx,kory,j,n,knmx,knmy,i,trn,k;
char A[101][101];
void f(int a,int b,char B[101][101])
{
	if(flag==1) return ;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	//if(B[a][b]!='.') return ;
	if(k>0)
	{
	if(B[a][b]!='.') return ;
	b++;
	if(B[a][b]!='.') return ;
	b++;
	if(B[a][b]!='.') return ;
	}
	k++;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	//~ for (int z = 1; z <=3; z++)
	//~ {for (int l = 1; l <=korx ; l++)
	//~ {
		//~ if(z==a && l==b)
		//~ {
			//~ printf("s");
			//~ continue ;
		//~ }
		//~ printf("%c",B[z][l]);
	//~ }
	//~ printf("\n");
		//~
	//~ }
	//~ printf("\n\n");
	b++;
	if(B[a][b]!='.') return ;
	f(a+1,b,B);
	f(a,b,B);
	f(a-1,b,B);
}
int main()
{
scanf("%d",&durum);
for (int i = 0; i <durum ; i++)
{
	scanf("%d %d",&korx,&trn);
	for(j=1;j<=3;j++)
	{
		for(n=1;n<=korx;n++)
		{
			scanf(" %c",&A[j][n]);
			if(A[j][n]=='s')
			{
				knmx=n;
				knmy=j;
				A[knmy][knmx]='.';
			}

	}

}
	f(knmy,knmx,A);
	if(flag==1)
	printf("YES");
	else
	printf("NO");
	flag=0;
	k=0;
}

}


#include<stdio.h>
int durum,flag,korx,kory,j,n,knmx,knmy,i,trn,k;
char A[101][101];
void f(int a,int b,char B[101][101])
{
	if(flag==1) return ;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	//if(B[a][b]!='.') return ;
	if(k>0)
	{
	if(B[a][b]!='.') return ;
	b++;
	if(B[a][b]!='.') return ;
	b++;
	if(B[a][b]!='.') return ;
	}
	k++;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	//~ for (int z = 1; z <=3; z++)
	//~ {for (int l = 1; l <=korx ; l++)
	//~ {
		//~ if(z==a && l==b)
		//~ {
			//~ printf("s");
			//~ continue ;
		//~ }
		//~ printf("%c",B[z][l]);
	//~ }
	//~ printf("\n");
		//~
	//~ }
	//~ printf("\n\n");
	b++;
	if(B[a][b]!='.') return ;
	f(a+1,b,B);
	f(a,b,B);
	f(a-1,b,B);
}
int main()
{
scanf("%d",&durum);
for (int i = 0; i <durum ; i++)
{
	scanf("%d %d",&korx,&trn);
	for(j=1;j<=3;j++)
	{
		for(n=1;n<=korx;n++)
		{
			scanf(" %c",&A[j][n]);
			if(A[j][n]=='s')
			{
				knmx=n;
				knmy=j;
				A[knmy][knmx]='.';
			}

	}

}
	f(knmy,knmx,A);
	if(flag==1)
	printf("YES\n");
	else
	printf("NO\n");
	flag=0;
	k=0;
}

}


#include <stdio.h>
int durum,flag,korx,kory,j,n,knmx,knmy,i,trn,k,o,q;
char A[101][101];
void f(int a,int b)
{
	if(A[a][b]=='0') return ;
	if(flag==1) return ;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	if(k>0)
	{
		if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	b++;
		if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	b++;
		if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	}
	k++;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	A[a][b]='0';
	b++;
	if(A[a][b]!='.') return ;

	f(a+1,b);
	f(a,b);
	f(a-1,b);
}
int main()
{
scanf("%d",&durum);
for (int i = 0; i <durum ; i++)
{
	scanf("%d %d",&korx,&trn);
	for(j=1;j<=3;j++)
	{
		for(n=1;n<=korx;n++)
		{
			scanf(" %c",&A[j][n]);
			if(A[j][n]=='s')
			{
				knmx=n;
				knmy=j;
				A[knmy][knmx]='.';
			}
			if(A[j][n]!='.' && o==0)
			{
				q++;o++;
			}
	}
	o=0;
}
	if(trn<3)
	{
	printf("YES\n");
	q=0;
	o=0;
	continue ;
	}
	if(n<3)
	{
		printf("YES\n");
		q=0;o=0;
		continue ;
	}
	f(knmy,knmx);
	if(flag==1)
	printf("YES\n");
	else
	printf("NO\n");
	flag=0;
	k=0;
}
}


#include <stdio.h>
int durum,flag,korx,kory,j,n,knmx,knmy,i,trn,k,o,q;
char A[101][101];
void f(int a,int b)
{
	if(A[a][b]=='<') return ;
	if(flag==1) return ;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	if(k>0)
	{
		if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	b++;
		if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	b++;
		if(b>=korx)
	{
		flag=1;
		return ;
	}
	if(A[a][b]!='.') return ;
	}
	k++;
	if(b>=korx)
	{
		flag=1;
		return ;
	}
	A[a][b]='<';
	b++;
	if(A[a][b]!='.') return ;
	if(b>=korx)
	{
		flag=1;
		return ;
	}

	f(a+1,b);
	f(a,b);
	f(a-1,b);
}
int main()
{
scanf("%d",&durum);
for (int i = 0; i <durum ; i++)
{
	scanf("%d %d",&korx,&trn);
	for(j=1;j<=3;j++)
	{
		for(n=1;n<=korx;n++)
		{
			scanf(" %c",&A[j][n]);
			if(A[j][n]=='s')
			{
				knmx=n;
				knmy=j;
				A[knmy][knmx]='.';
			}

	}

}

	f(knmy,knmx);
	if(flag==1)
	printf("YES\n");
	else
	printf("NO\n");
	flag=0;
	k=0;
}
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n,a,b,c=0;
    string s;
    cin>>n>>a>>b>>s;
       if((a+b)==n)
        {
            cout<<2<<endl;
          for(int i=0;i<a;i++)
                cout<<s[i];
          cout<<endl;
          for(int i=a;i<n;i++)
                cout<<s[i];
          cout<<endl;
        }
        else if(n%b==0)
        {
            int x=b;
            cout<<n/b<<endl;
            for(int i=0;i<n;i++){
                if(i==x){
                cout<<endl;
                x+=b;}
                cout<<s[i];
                }
        }
        else if(n%a==0)
        {
            int x=a;
            for(int i=0;i<n;i++){
                if(i==x){
                x+=a;
                cout<<endl;}
                cout<<s[i];}

        }
        else
            cout<<-1;

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n,a,b;
    string s;
    cin>>n>>a>>b>>s;
       if(n%a==0)
       {
           int x=n/a,k=0;
           while(x>0)
           {
               for(int i = 0; i < a; i++)
                cout<<s[k++];
                cout<<endl;
               x--;
           }
       }
       else if(n%b==0)
       {
           int x=n/b,k=0;
           while(x>0)
           {
               for(int i = 0; i < b; i++)
                cout<<s[k++];
                cout<<endl;
               x--;
           }
       }
       else
       {
           int c=0,m=0,x,y;
           while(n>0)
           {
               n-=a,c++;
               if(n%b==0){
                m=1;
                x=c;
                y=n/b;
                break;}
           }
           if(m==0)
           {
               while(n>0)
           {
               n-=b,c++;
               if(n%a==0){
                m=1;
                x=n/a;
                y=c;
                break;}
           }
           }
           if(m==0)
            cout<<-1;
           else
           {
               int k=0;
            while(x>0)
           {
               for(int i = 0; i < a; i++)
                cout<<s[k++];
                cout<<endl;
               x--;
           }
           while(y>0)
           {
               for(int i = 0; i < b; i++)
                cout<<s[k++];
                cout<<endl;
               y--;
           }
        }
       }

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n,a,b;
    string s;
    cin>>n>>a>>b>>s;
       if(n%a==0)
       {
           int x=n/a,k=0;
           cout<<x<<endl;
           while(x>0)
           {
               for(int i = 0; i < a; i++)
                cout<<s[k++];
                cout<<endl;
               x--;
           }
       }
       else if(n%b==0)
       {
           int x=n/b,k=0;
           cout<<x<<endl;
           while(x>0)
           {
               for(int i = 0; i < b; i++)
                cout<<s[k++];
                cout<<endl;
               x--;
           }
       }
       else
       {
           int c=0,m=0,x,y;
           while(n>0)
           {
               n-=a,c++;
               if(n%b==0){
                m=1;
                x=c;
                y=n/b;
                break;}
           }
           if(m==0)
           {
               while(n>0)
           {
               n-=b,c++;
               if(n%a==0){
                m=1;
                x=n/a;
                y=c;
                break;}
           }
           }
           if(m==0)
            cout<<-1;
           else
           {
               int k=0;
               cout<<x+y<<endl;
            while(x>0)
           {
               for(int i = 0; i < a; i++)
                cout<<s[k++];
                cout<<endl;
               x--;
           }
           while(y>0)
           {
               for(int i = 0; i < b; i++)
                cout<<s[k++];
                cout<<endl;
               y--;
           }
        }
       }

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n,a,b,c=0,m=0;
    string s;
    cin>>n>>a>>b>>s;
       if((a+b)==n && a!=b)
        {
            cout<<2<<endl;
          for(int i=0;i<a;i++)
                cout<<s[i];
          cout<<endl;
          for(int i=a;i<n;i++)
                cout<<s[i];
          cout<<endl;
          m=1;
        }
        else if(n%b==0 && b!=a)
        {
            int x=b;
            cout<<n/b<<endl;
            for(int i=0;i<n;i++){
                if(i==x){
                cout<<endl;
                x+=b;}
                cout<<s[i];
                }
            m=1;
        }
        else if(n%a==0)
        {
            int x=a;
            cout<<n/a<<endl;
            for(int i=0;i<n;i++){
                if(i==x){
                x+=a;
                cout<<endl;}
                cout<<s[i];}
        m=1;
        }
        if(m==0)
            cout<<-1;

    return 0;
}


// 612A.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <tchar.h>
#include <iostream>

using namespace std;
void ReadOut(int count)
{
    for (int i = 0; i < count; i++)
    {
        char a;
        cin >> a;
        cout << a;
    }
    cout << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
    int n, p, q;
    cin >> n >> p >> q;
    if (p + q == n)
    {
        cout << 2 << endl;
        ReadOut(p);
        ReadOut(q);
    }
    else
    if (n%p == 0){
        cout << n / p << endl;
        for (int j = 0; j < n / p; j++)
        {
            ReadOut(p);
        }
    }
    else
    if (n%q == 0){
        cout << n / q << endl;
        for (int j = 0; j < n / q; j++)
        {
            ReadOut(q);
        }
    }
    else { cout << -1; }

    return 0;
}


// 612A.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <tchar.h>
#include <iostream>

using namespace std;
void ReadOut(int count)
{
    for (int i = 0; i < count; i++)
    {
        char a;
        cin >> a;
        cout << a;
    }
    cout << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
    int n, p, q;
    cin >> n >> p >> q;
    if (p + q == n)
    {
        ReadOut(p);
        ReadOut(q);
    }
    else
    if (n%p == 0){
        for (int j = 0; j < n / p; j++)
        {
            ReadOut(p);
        }
    }
    else
    if (n%q == 0){
        for (int j = 0; j < n / q; j++)
        {
            ReadOut(q);
        }
    }
    else { cout << -1; }

    return 0;
}


// 612A.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <tchar.h>
#include <iostream>

using namespace std;
void ReadOut(int count)
{
    for (int i = 0; i < count; i++)
    {
        char a;
        cin >> a;
        cout << a;
    }
    cout << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
    int n, p, q;
    cin >> n >> p >> q;
    int qCount = 0, p1 = p, q1 = q, n1 = n;
    int pCount = 0;
    bool isCan = false;
    while (n>0)
    {
        n -= p;
        pCount++;
        if (n%q == 0)
        {
            qCount = n / q;
            isCan = true;
            n = 0;
        }
    }
    if (isCan)
    {
        cout << qCount+pCount << endl;
        for (int u = 0; u < pCount; u++)
        {
            ReadOut(p);
        }

        for (int u = 0; u < qCount; u++)
        {
            ReadOut(q);
        }
    }
    else
    if (n%p == 0){
        cout << n / p << endl;
        for (int j = 0; j < n / p; j++)
        {
            ReadOut(p);
        }
    }
    else
    if (n%q == 0){
        cout << n / q << endl;
        for (int j = 0; j < n / q; j++)
        {
            ReadOut(q);
        }
    }
    else { cout << -1; }

    return 0;
}


// 612A.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <tchar.h>
#include <iostream>

using namespace std;
void ReadOut(int count)
{
    for (int i = 0; i < count; i++)
    {
        char a;
        cin >> a;
        cout << a;
    }
    cout << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
    int n, p, q;
    cin >> n >> p >> q;
    int qCount = 0, p1 = p, q1 = q, n1 = n;
    int pCount = 0;
    bool isCan = false;
    while (n1>0)
    {
        n1 -= p;
        pCount++;
        if (n1> 0 && n1%q == 0)
        {
            qCount = n1 / q;
            isCan = true;
            n1 = 0;
        }
    }
    if (isCan)
    {
        cout << qCount+pCount << endl;
        for (int u = 0; u < pCount; u++)
        {
            ReadOut(p);
        }

        for (int u = 0; u < qCount; u++)
        {
            ReadOut(q);
        }
    }
    else
    if (n%p == 0){
        cout << n / p << endl;
        for (int j = 0; j < n / p; j++)
        {
            ReadOut(p);
        }
    }
    else
    if (n%q == 0){
        cout << n / q << endl;
        for (int j = 0; j < n / q; j++)
        {
            ReadOut(q);
        }
    }
    else { cout << -1; }

    return 0;
}


// 612A.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <tchar.h>
#include <iostream>

using namespace std;
void ReadOut(int count)
{
    for (int i = 0; i < count; i++)
    {
        char a;
        cin >> a;
        cout << a;
    }
    cout << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
    int n, p, q;
    cin >> n >> p >> q;
    int qCount = 0, p1 = p, q1 = q, n1 = n;
    int pCount = 0;
    bool isCan = false;
    while (n1>0)
    {
        n1 -= p;
        pCount++;
        if (n1%q == 0)
        {
            qCount = n1 / q;
            isCan = true;
            n1 = 0;
        }
    }
    if (isCan)
    {
        cout << qCount+pCount << endl;
        for (int u = 0; u < pCount; u++)
        {
            ReadOut(p);
        }

        for (int u = 0; u < qCount; u++)
        {
            ReadOut(q);
        }
    }
    else
    if (n%p == 0){
        cout << n / p << endl;
        for (int j = 0; j < n / p; j++)
        {
            ReadOut(p);
        }
    }
    else
    if (n%q == 0){
        cout << n / q << endl;
        for (int j = 0; j < n / q; j++)
        {
            ReadOut(q);
        }
    }
    else { cout << -1; }

    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int n,p,q;
	string str;
	cin>>n>>p>>q;
	cin>>str;

	if(str.size()%p==0)
	{
		cout<<str.size()/p<<endl;
		for(int x=0;x<str.size();x+=p)
			cout<<str.substr(x,p)<<endl;
	}
	else if(str.size()%q==0)
	{
		cout<<str.size()/q<<endl;
		for(int x=0;x<str.size();x+=q)
			cout<<str.substr(x,q)<<endl;
	}
	else
	{
		int diff=str.size();
		bool cant=false,can=false;
		while(diff>0)
		{
			diff-=p;
			if(diff<0)
				cant=true;

			if(diff%q==0)
			{
				diff=str.size()-diff;
				can=true;
				break;
			}

		}
		if(cant)
			cout<<-1<<endl;
		else
		{
			if(can)
			{
				cout<<diff/p + ((str.size()-diff)/q)<<endl;
				for(int x=0;x<diff;x+=p)
					cout<<str.substr(x,p)<<endl;
				for(int x=diff;x<str.size();x+=q)
					cout<<str.substr(x,q)<<endl;
			}

		}

	}

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int n,p,q;
	string str;
	cin>>n>>p>>q;
	cin>>str;

	if(str.size()%p==0)
	{
		cout<<str.size()/p<<endl;
		for(int x=0;x<str.size();x+=p)
			cout<<str.substr(x,p)<<endl;;
	}
	else if(str.size()%q==0)
	{
		cout<<str.size()/q<<endl;
		for(int x=0;x<str.size();x+=q)
			cout<<str.substr(x,q)<<endl;
	}
	else if(str.size()%p!=0 && (str.size()%p) % q==0)
	{
		cout<<str.size()/p + ((str.size()%p) / q)<<endl;
		for(int x=0;x<str.size()-(str.size()%p);x+=p)
			cout<<str.substr(x,p)<<endl;
		for(int x=str.size()-(str.size()%p);x<str.size();x+=q)
			cout<<str.substr(x,q)<<endl;
	}
	else if(str.size()%q!=0 && (str.size()%q) % p==0)
	{
		cout<<str.size()/q + ((str.size()%q) / p)<<endl;
		for(int x=0;x<str.size()-(str.size()%q);x+=q)
			cout<<str.substr(x,q)<<endl;
		for(int x=str.size()-(str.size()%q);x<str.size();x+=p)
			cout<<str.substr(x,p)<<endl;
	}
	else
		cout<<-1<<endl;

	return 0;
}


#include <fstream>
#include <algorithm>
#include <string>
#include <iostream>

#ifdef ONLINE_JUDGE
	#define q std::cin
	#define w std::cout
#endif

int main(){
	//std::ifstream q("input.txt");
	//std::ofstream w("output.txt");
	std::ifstream q("q.in");
	std::ofstream w("w.out");
	int p,t,n;
	std::string s;
	q >> n >> p >> t;
	q >> s;
	if (n % p == 0){
		int k = n / p;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * p; j < (i+1) * p; j++){
				w << s[j];
			}
			w << std::endl;
		}
		return 0;
	}
	if (n % t == 0){
		int k = n / t;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * t; j < (i + 1) * t; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	if (t > p)std::swap(t, p);
	int z = 0,k = 0;
	bool v = true;
	std::string b;
	while (n >= 0){
		if (n % p == 0){
			k = n / p;
			w << k + z << std::endl;
			for (int i = 0; i < k; i++){
				for (int j = i * p; j < (i + 1) * p; j++){
					w << s[j];
				}
				w << std::endl;
			}
			v = false;
			break;
		}
		else{
			n -= t;
			z++;
		}
	}
	if (v){
		for (int i = 0; i < z; i++){
			for (int j = i * t + n; j < (i + 1) * t + n; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	else w << -1;
	return 0;
}


#include <iostream>
#include <string>

#define z std
#define q z::cin
#define w z::cout

int main(){
    int n, p, t, a = 0, b = 0;
    q >> n >> p >> t;
    z::string s;
    q >> s;
    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= n; j++){
            if (p * i + t * j == n){
                a = i;
                b = j;
            }
        }
    }
    if (a + b == 0){
        w << -1;
        return 0;
    }
    w << a + b << z::endl;
    for (int i = 0; i < a; i++){
        for (int j = 0; j < p; j++){
            w << s[j];
        }
        s.erase(0, p);
        w << std::endl;
    }
    for (int i = 0; i < b; i++){
        for (int j = 0; j < t; j++){
            w << s[j];
        }
        s.erase(0, t);
        w << std::endl;
    }
    //q >> a;
}


#include <iostream>
#include <string>

#define z std
#define q z::cin
#define w z::cout

int main(){
    int n, p, t, a = 0, b = 0;
    q >> n >> p >> t;
    z::string s;
    q >> s;
    for (int i = 0; i <= n; i++){
        for (int j = 0; j < n; j++){
            if (p * i + t * j == n){
                a = i;
                b = j;
            }
        }
    }
    if ((a == 0) && (b == 0)){
        w << -1;
        return 0;
    }
    for (int i = 0; i < a; i++){
        for (int j = 0; j < p; j++){
            w << s[j];
        }
        s.erase(0, p);
        w << std::endl;
    }
    for (int i = 0; i < b; i++){
        for (int j = 0; j < t; j++){
            w << s[j];
        }
        s.erase(0, t);
        w << std::endl;
    }
    //q >> a;
}


#include <iostream>
#include <string>

#define z std
#define q z::cin
#define w z::cout

int main(){
    int n, p, t, a = 0, b = 0;
    q >> n >> p >> t;
    z::string s;
    q >> s;
    while (((n - b * t) % p != 0)&&(n >= b * t)){
        b++;
    }
    if (n < b * t){
        w << -1;
        return 0;
    }
    a = (n - b * t) / p;
    for (int i = 0; i < a; i++){
        for (int j = i * p; j < (i + 1) * p; j++){
            w << s[j];
        }
        w << std::endl;
    }
    for (int i = 0; i < b; i++){
        for (int j = i * t + a * p; j < (i + 1) * t + a * t; j++){
            w << s[j];
        }
        w << std::endl;
    }
    //q >> a;
}


#include <fstream>
#include <algorithm>
#include <string>
#include <iostream>

#define q std::cin
#define w std::cout

int main(){
	//std::ifstream q("input.txt");
	//std::ofstream w("output.txt");
	//std::ifstream q("q.in");
	//std::ofstream w("w.out");
	int p,t,n;
	std::string s;
	q >> n >> p >> t;
	q >> s;
	if (n % p == 0){
		int k = n / p;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * p; j < (i+1) * p; j++){
				w << s[j];
			}
			w << std::endl;
		}
		return 0;
	}
	if (n % t == 0){
		int k = n / t;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * t; j < (i + 1) * t; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	if (t > p)std::swap(t, p);
	int z = 0,k = 0;
	std::string b;
	while (n > 0){
		if (n % p == 0){
			k = n / p;
			w << k + z << std::endl;
			for (int i = 0; i < k; i++){
				for (int j = i * p; j < (i + 1) * p; j++){
					w << s[j];
					b += s[j];
				}
				w << std::endl;
				b = "";
			}
			break;
		}
		else{
			n -= t;
			z++;
		}
	}
	if (n % p == 0){
		//int k = n / t;
		//w << k << std::endl;
		for (int i = 0; i < z; i++){
			for (int j = i * t + n; j <= (i + 1) * t + n - 1; j++){
				w << s[j];
				b += s[j];
			}
			w << std::endl;
			b = "";
		}
	}
	else w << -1;
	//w << o;
	return 0;
}


#include <fstream>
#include <algorithm>
#include <string>
#include <iostream>

#ifdef ONLINE_JUDGE
	#define q std::cin
	#define w std::cout
#endif

int main(){
	//std::ifstream q("input.txt");
	//std::ofstream w("output.txt");
	#ifndef ONLINE_JUDGE
		//std::ifstream q("q.in");
		//std::ofstream w("w.out");
	#endif
	int p,t,n;
	std::string s;
	q >> n >> p >> t;
	q >> s;
	if (n % p == 0){
		int k = n / p;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * p; j < (i+1) * p; j++){
				w << s[j];
			}
			w << std::endl;
		}
		return 0;
	}
	if (n % t == 0){
		int k = n / t;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * t; j < (i + 1) * t; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	if (t > p)std::swap(t, p);
	int z = 0,k = 0;
	bool v = true;
	std::string b;
	while (n >= 0){
		if (n % p == 0){
			k = n / p;
			w << k + z << std::endl;
			for (int i = 0; i < k; i++){
				for (int j = i * p; j < (i + 1) * p; j++){
					w << s[j];
				}
				w << std::endl;
			}
			v = false;
			break;
		}
		else{
			n -= t;
			z++;
		}
	}
	if (!v){
		for (int i = 0; i < z; i++){
			for (int j = i * t + n; j < (i + 1) * t + n; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	else w << -1;
	return 0;
}


#include <fstream>
#include <algorithm>
#include <string>
#include <iostream>

//#define q std::cin
//#define w std::cout

int main(){
	//std::ifstream q("input.txt");
	//std::ofstream w("output.txt");
	std::ifstream q("q.in");
	std::ofstream w("w.out");
	int p,t,n;
	std::string s;
	q >> n >> p >> t;
	q >> s;
	if (n % p == 0){
		int k = n / p;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * p; j < (i+1) * p; j++){
				w << s[j];
			}
			w << std::endl;
		}
		return 0;
	}
	if (n % t == 0){
		int k = n / t;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * t; j < (i + 1) * t; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	if (t > p)std::swap(t, p);
	int z = 0,k = 0;
	std::string b;
	while (n > 0){
		if (n % p == 0){
			k = n / p;
			w << k + z << std::endl;
			for (int i = 0; i < k; i++){
				for (int j = i * p; j < (i + 1) * p; j++){
					w << s[j];
					b += s[j];
				}
				w << std::endl;
				b = "";
			}
			break;
		}
		else{
			n -= t;
			z++;
		}
	}
	if (n % p == 0){
		//int k = n / t;
		//w << k << std::endl;
		for (int i = 0; i < z; i++){
			for (int j = i * t + n; j <= (i + 1) * t + n - 1; j++){
				w << s[j];
				b += s[j];
			}
			w << std::endl;
			b = "";
		}
	}
	else w << -1;
	//w << o;
	return 0;
}


#include <fstream>
#include <algorithm>
#include <string>
#include <iostream>

#define q std::cin
#define w std::cout

int main(){
	//std::ifstream q("input.txt");
	//std::ofstream w("output.txt");
	//std::ifstream q("q.in");
	//std::ofstream w("w.out");
	int p,t,n;
	std::string s;
	q >> n >> p >> t;
	q >> s;
	if (n % p == 0){
		int k = n / p;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * p; j < (i+1) * p; j++){
				w << s[j];
			}
			w << std::endl;
		}
		return 0;
	}
	if (n % t == 0){
		int k = n / t;
		w << k << std::endl;
		for (int i = 0; i < k; i++){
			for (int j = i * t; j < (i + 1) * t; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	if (t > p)std::swap(t, p);
	int z = 0,k = 0;
	while (n > 0){
		if (n % p == 0){
			k = n / p;
			w << k + z << std::endl;
			for (int i = 0; i < k; i++){
				for (int j = i * p; j < (i + 1) * p; j++){
					w << s[j];
				}
				w << std::endl;
			}
			break;
		}
		else{
			n -= t;
			z++;
		}
	}
	if (n % p == 0){
		//int k = n / t;
		//w << k << std::endl;
		for (int i = k; i < k + z; i++){
			for (int j = i * t + 1; j <= (i + 1) * t; j++){
				w << s[j];
			}
			w << std::endl;
		}
	}
	else w << -1;
	//w << o;
	return 0;
}


#include <fstream>
#include <algorithm>
#include <string>
#include <iostream>

#ifdef ONLINE_JUDGE
    #define q std::cin
    #define w std::cout
#endif

int main(){
    //std::ifstream q("input.txt");
    //std::ofstream w("output.txt");
    #ifndef ONLINE_JUDGE
        std::ifstream q("q.in");
        std::ofstream w("w.out");
    #endif
    int p,t,n;
    std::string s;
    q >> n >> p >> t;
    q >> s;
    if (n % p == 0){
        int k = n / p;
        w << k << std::endl;
        for (int i = 0; i < k; i++){
            for (int j = i * p; j < (i+1) * p; j++){
                w << s[j];
            }
            w << std::endl;
        }
        return 0;
    }
    if (n % t == 0){
        int k = n / t;
        w << k << std::endl;
        for (int i = 0; i < k; i++){
            for (int j = i * t; j < (i + 1) * t; j++){
                w << s[j];
            }
            w << std::endl;
        }
    }
    if (t > p)std::swap(t, p);
    int z = 0,k = 0;
    bool v = true;
    std::string b;
    while (n >= 0){
        if (n % p == 0){
            k = n / p;
            w << k + z << std::endl;
            for (int i = 0; i < k; i++){
                for (int j = i * p; j < (i + 1) * p; j++){
                    w << s[j];
                }
                w << std::endl;
            }
            v = false;
            break;
        }
        else{
            n -= t;
            z++;
        }
    }
    if (v){
        for (int i = 0; i < z; i++){
            for (int j = i * t + n; j < (i + 1) * t + n; j++){
                w << s[j];
            }
            w << std::endl;
        }
    }
    else w << -1;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

typedef long long LL;
using namespace std;
int n, a, b;
string s;
int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	cin >> n >> a >> b >> s;
	if (n%a == 0) {
		int q = 0;
		for (int i = 0; i < n/a; ++i){
			for (int j = 0; j < a; ++j){
				cout << s[q+j];
			}
			q += a;
			cout << endl;
		}
	}
	else
	if (n%b == 0) {
		int q = 0;
		for (int i = 0; i < n/b; ++i){
			for (int j = 0; j < b; ++j){
				cout << s[q+j];
			}
			q += b;
			cout << endl;
		}
	}
	else{
		bool flag = false;
		int l = 0, r = 0;
		for (int k = 0; k < 100; ++k){
			if (flag) break;
			for (int p = 0; p < 100; ++p){
				if (n == a*k + b*p){
					l = k;
					r = p;
					flag = true;
					break;
				}
			}
		}
		if (!flag) { cout << -1 << endl; return 0; }
		int q = 0;
		for (int i = 0; i < l; ++i){
			for (int j = 0; j < a; ++j){
				cout << s[q+j];

			}
			q+=a;
			cout << endl;
		}

		for (int i = 0; i < r; ++i){
			for (int j = 0; j < b; ++j){
				cout << s[q+j];
			}
			q += b;
			cout << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

typedef long long LL;
using namespace std;
int n, a, b;
string s;
int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	cin >> n >> a >> b >> s;
	if (n%a == 0) {
		int q = 0;
		cout << n / a << endl;
		for (int i = 0; i < n/a; ++i){
			for (int j = 0; j < a; ++j){
				cout << s[q+j];
			}
			q += a;
			cout << endl;
		}
	}
	else
	if (n%b == 0) {
		int q = 0;
		cout << n / b << endl;
		for (int i = 0; i < n/b; ++i){
			for (int j = 0; j < b; ++j){
				cout << s[q+j];
			}
			q += b;
			cout << endl;
		}
	}
	else{
		bool flag = false;
		int l = 0, r = 0;
		for (int k = 0; k < 100; ++k){
			if (flag) break;
			for (int p = 0; p < 100; ++p){
				if (n == a*k + b*p){
					l = k;
					r = p;
					flag = true;
					break;
				}
			}
		}
		if (!flag) { cout << -1 << endl; return 0; }
		int q = 0;
		cout << l + r << endl;
		for (int i = 0; i < l; ++i){
			for (int j = 0; j < a; ++j){
				cout << s[q+j];

			}
			q+=a;
			cout << endl;
		}

		for (int i = 0; i < r; ++i){
			for (int j = 0; j < b; ++j){
				cout << s[q+j];
			}
			q += b;
			cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include<map>
#include<queue>
#include <functional>
#include<set>
using namespace std;

int main()
{
	int n,p,q;
	string s;
	cin>>n>>p>>q>>s;
	pair<int,int>res;
	bool flag=false;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
			if(i*p+j*q==n)
			{
				flag=true;
				res=make_pair(i,j);
				break;
			}
			if(flag)
				break;
	}
	if(!flag)
	{cout<<-1;return 0;}
	cout<<res.first+res.second<<endl;
	int i=0;
	for(int k=0;k<res.first;k++)
	{
        cout<<s.substr(i,p);
		 i+=p;
		 cout<<endl;
	}
	int k=res.first*p;
	for(int i=0;i<res.second;i++)
	{
		cout<<s.substr(k,q);
		k+=q;
		cout<<endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include<map>
#include<queue>
#include <functional>
#include<set>
using namespace std;

int main()
{
	int n,p,q;
	string s;
	cin>>n>>p>>q>>s;
	pair<int,int>res;
	bool flag=false;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
			if(i*p+j*q==n)
			{
				flag=true;
				res=make_pair(i,j);
				break;
			}
			if(flag)
				break;
	}
	if(!flag)
	{cout<<-1;return 0;}
	int j=0;
	for(int k=0;k<res.first;k++)
	{
		int i;
         for(i=j;i<j+p;i++)
		 {
				 cout<<s[i];
	   }
		 j=i;
		 cout<<endl;
	}
	int k=res.first*p;
	for(int i=0;i<res.second;i++)
	{
		int j=k;
		for(j=k;j<k+q;j++)
		{
			cout<<s[j];
		}
		k=j;
		cout<<endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include<map>
#include<queue>
#include <functional>
#include<set>
using namespace std;

int main()
{
	int n,p,q;
	string s;
	cin>>n>>p>>q>>s;
	pair<int,int>res;
	bool flag=false;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
			if(i*p+j*q==n)
			{
				flag=true;
				res=make_pair(i,j);
				break;
			}
			if(flag)
				break;
	}
	if(!flag)
	{cout<<-1;return 0;}
	cout<<res.first+res.second<<endl;
	int j=0;
	for(int k=0;k<res.first;k++)
	{
		int i;
         for(i=j;i<j+p;i++)
		 {
				 cout<<s[i];
	   }
		 j=i;
		 cout<<endl;
	}
	int k=res.first*p;
	for(int i=0;i<res.second;i++)
	{
		int j=k;
		for(j=k;j<k+q;j++)
		{
			cout<<s[j];
		}
		k=j;
		cout<<endl;
	}
	return 0;
}


#include <string>
#include <iostream>
using namespace std;
string pal;
int N, p, q, aux, res=0;
bool imprime(int sub1, int sub2) {
	if (sub1 == -1) {
		cout << -1;
		return false;
	}
	int actual = 0;
	if (sub2 == sub1) {
		cout << N / sub1 << endl;
	}
	else {
		cout << N / sub1 + 1 << endl;
	}
	while (actual < pal.size()) {
		for (int i = 0; i < N / sub1; i++) {
			for (int j = 0; j < sub1; j++) {
				cout << pal[actual];
				actual++;
			}
			cout << endl;
		}
		if (actual < pal.size()) {
			for (int i = 1; i <=sub2; i++) {
				cout << pal[actual];
				actual++;
			}
		}
	}

}
int checa() {
	aux = 0;
	if (p == q) {
		imprime(p, p);
		return 0;
	}
	if (N%p == 0) {
		imprime(p, p);
		return 0;
	}
	else {
		aux = N % p;
		if (aux%q == 0) {
			imprime(p, q);
			return 0;
		}
	}
	if (N%q == 0) {
		imprime(q, q);
		return 0;
	}
	else {
		aux = N % q;
		if (aux%p == 0) {
			imprime(q, p);
			return 0;
		}
	}
	imprime(-1, 0);
}
int main()
{
	cin >> N >> p >> q >> pal;
	checa();

    return 0;
}


// Splits.cpp: define el punto de entrada de la aplicación de consola.

#include <string>
#include <iostream>
using namespace std;
string pal;
int N, p, q, aux, res=0;
bool imprime(int sub1, int sub2) {
	if (sub1 == -1) {
		cout << -1;
		return false;
	}
	int actual = 0;
	if (sub2 == sub1) {
		cout << N / sub1 << endl;
	}
	else {
		int lineas = (N / sub1);
		lineas += (N%sub1)/ sub2;
		cout << lineas<<endl;
	}
	while (actual < pal.size()) {
		for (int i = 0; i < N / sub1; i++) {
			for (int j = 0; j < sub1; j++) {
				cout << pal[actual];
				actual++;
			}
			cout << endl;
		}
		if (actual < pal.size()) {
			for (int i = 1; i <=(N%sub1)/sub2; i++) {
				for (int j = 0; j < sub2; j++) {
					cout << pal[actual];
					actual++;
				}
				cout << endl;
			}
		}
	}

}
int checa() {
	aux = 0;
	if (p == q) {
		imprime(p, p);
		return 0;
	}
	if (N%p == 0) {
		imprime(p, p);
		return 0;
	}
	else {
		aux = N % p;
		if (aux%q == 0) {
			imprime(p, q);
			return 0;
		}
	}
	if (N%q == 0) {
		imprime(q, q);
		return 0;
	}
	else {
		aux = N % q;
		if (aux%p == 0) {
			imprime(q, p);
			return 0;
		}
	}
	imprime(-1, 0);
}
int main()
{
	cin >> N >> p >> q >> pal;
	checa();

    return 0;
}


// Splits.cpp: define el punto de entrada de la aplicación de consola.

#include <string>
#include <iostream>
using namespace std;
string pal;
int N, p, q, aux, res=0;
bool imprime(int sub1, int sub2,int rep1,int rep2) {
	if (sub1 == -1) {
		cout << -1;
		return false;
	}
	int actual = 0;
	if (sub2 == sub1) {
		cout << N / sub1 << endl;
	}
	else {
		/*int lineas = (N / sub1);
		lineas += (N%sub1)/ sub2;*/
		int lineas = rep1 + rep2;
		cout << lineas<<endl;
	}
	while (actual < pal.size()) {
		for (int i = 0; i < rep1; i++) {
			for (int j = 0; j < sub1; j++) {
				cout << pal[actual];
				actual++;
			}
			cout << endl;
		}
		if (actual < pal.size()) {
			for (int i = 1; i <=rep2; i++) {
				for (int j = 0; j < sub2; j++) {
					cout << pal[actual];
					actual++;
				}
				cout << endl;
			}
		}
	}

}
int checa() {
	aux = 0;
	if (p == q) {
		imprime(p, p,N/p,N/p);
		return 0;
	}
	if (N%p == 0) {
		imprime(p, p, N / p, N / p);
		return 0;
	}
	else {
		aux = N % p;
		for (int i = 1; i <= 10000; i++) {
			aux = N -( p*i);
			if (aux <=0) {
				break;
			}
			if (aux%q == 0) {
				//imprime(p, q,N/(p*i),(N-(N/(p*i))*p)/3);
				imprime(p, q, i,(N- p*i)/ q);
				return 0;
			}
		}
	}
	if (N%q == 0) {
		imprime(q, q, N / q, N / q);
		return 0;
	}
	else {
		aux = N % q;
		for (int i = 1; i <= 10000; i++) {
			aux = N % (q*i);
			if (aux%p == 0) {
				imprime(q, p, i, (N - (q*i)) / p);
				return 0;
			}
		}
	}
	imprime(-1, 0,0,0);
}
int main()
{
	cin >> N >> p >> q >> pal;
	checa();

    return 0;
}


// Splits.cpp: define el punto de entrada de la aplicación de consola.

#include <string>
#include <iostream>
using namespace std;
string pal;
int N, p, q, aux, res=0;
bool imprime(int sub1, int sub2,int rep1,int rep2) {
	if (sub1 == -1) {
		cout << -1;
		return false;
	}
	int actual = 0;
	if (sub2 == sub1) {
		cout << N / sub1 << endl;
	}
	else {
		/*int lineas = (N / sub1);
		lineas += (N%sub1)/ sub2;*/
		int lineas = rep1 + rep2;
		cout << lineas<<endl;
	}
	while (actual < pal.size()) {
		for (int i = 0; i < rep1; i++) {
			for (int j = 0; j < sub1; j++) {
				cout << pal[actual];
				actual++;
			}
			cout << endl;
		}
		if (actual < pal.size()) {
			for (int i = 1; i <=rep2; i++) {
				for (int j = 0; j < sub2; j++) {
					cout << pal[actual];
					actual++;
				}
				cout << endl;
			}
		}
	}

}
int checa() {
	aux = 0;
	if (p == q) {
		if (N%p == 0) {
			imprime(p, p, N / p, N / p);
			return 0;
		}
	}
	if (N%p == 0) {
		imprime(p, p, N / p, N / p);
		return 0;
	}
	else {
		aux = N % p;
		for (int i = 1; i <= 10000; i++) {
			aux = N -( p*i);
			if (aux <=0) {
				break;
			}
			if (aux%q == 0) {
				//imprime(p, q,N/(p*i),(N-(N/(p*i))*p)/3);
				imprime(p, q, i,(N- p*i)/ q);
				return 0;
			}
		}
	}
	if (N%q == 0) {
		imprime(q, q, N / q, N / q);
		return 0;
	}
	else {
		aux = N % q;
		for (int i = 1; i <= 10000; i++) {
			aux = N % (q*i);
			if (aux%p == 0) {
				imprime(q, p, i, (N - (q*i)) / p);
				return 0;
			}
		}
	}
	imprime(-1, 0,0,0);
}
int main()
{
	cin >> N >> p >> q >> pal;
	checa();

    return 0;
}


#include <cstdio>
#include <cmath>

int main()
{
	int n,p,q;
	double x, y;
	char s[105];

	scanf("%d %d %d\n", &n, &p, &q);
	scanf("%s", s);

	for (x = 0; x <= ceil((double)n/p); ++x)
	{
		y = (n - x * p) / q;
		if ((int)y == y)
		{
			printf("%d\n", (int)x + (int)y);
			for (int k = 0; k < x; ++k)
			{
				for (int i = 0; i < p; ++i)
					printf("%c", s[i + k * p]);
				printf("\n");
			}

			for (int k = 0; k < y; ++k)
			{
				for (int i = 0; i < q; ++i)
					printf("%c", s[(int)x * p + i + k * q]);
				printf("\n");
			}
			return 0;
		}
	}
	printf("-1");
	return 0;
}


#include <cstdio>
#include <cmath>

int main()
{
	int n,p,q;
	double x, y;
	char s[105];

	scanf("%d %d %d\n", &n, &p, &q);
	scanf("%s", s);

	for (x = 0; x <= ceil((double)n/p); ++x)
	{
		y = (n - x * p) / q;
		if ((int)y == y && y >= 0)
		{
			printf("%d\n", (int)x + (int)y);
			for (int k = 0; k < x; ++k)
			{
				for (int i = 0; i < p; ++i)
					printf("%c", s[i + k * p]);
				printf("\n");
			}

			for (int k = 0; k < y; ++k)
			{
				for (int i = 0; i < q; ++i)
					printf("%c", s[(int)x * p + i + k * q]);
				printf("\n");
			}
			return 0;
		}
	}
	printf("-1");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
using namespace std;
vector<pair<int,int>> w;
int main()
{

	//freopen("input.txt","r",stdin);
	//freopen();
	int n,p,q;
	cin >> n >> p >> q;
	string a; cin >> a;
	w.resize(n+1);
	for(int i = 0 ; i < w.size(); i++)
	{
		w[i].first=-1;
		w[i].second=-1;
	}
	w[0].first=w[0].second=0;
	for(int i = 0 ; i < w.size(); i++)
	{
		if(w[i].first!=-1)
		{
			if(i+p<=n)
			{
				w[i+p].first=w[i].first+1;
				w[i+p].second=w[i].second;
				if(w[i+p].first==0)
				{
					w[i+p].first=1;
				}
			}
			if(i+q<=n)
			{
				w[i+q].first=w[i].first;
				w[i+q].second=w[i].second+1;
				if(w[i+q].second==0)
				{
					w[i+q].second=1;
				}
			}
		}
	}
	int x = 0;
	if(w[n].first==-1&&w[n].second==-1)
	{
		cout << "-1";
	}
	else
	{
		cout << w[n].first+w[n].second << endl;
		for(int i = 0 ; i < w[n].first; i++)
		{
			for(int j = 0 ; j < p ; j++)
			{
				cout << a[x];
				x++;
			}
			cout << endl;
		}
		for(int i = 0 ; i < w[n].second; i++)
		{
			for(int j = 0 ; j < q ; j++)
			{
				cout << a[x];
				x++;
			}
			cout << endl;
		}
	}
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
using namespace std;
vector<pair<int,int>> w;
int main()
{

	//freopen("input.txt","r",stdin);
	//freopen();
	int n,p,q;
	cin >> n >> p >> q;
	string a; cin >> a;
	w.resize(n+1);
	for(int i = 0 ; i < w.size(); i++)
	{
		w[i].first=-1;
		w[i].second=-1;
	}
	w[0].first=w[0].second=0;
	for(int i = 0 ; i < w.size(); i++)
	{
		if(w[i].first!=-1)
		{
			if(i+p<=n)
			{
				w[i+p].first=w[i].first+1;
				w[i+p].second=w[i].second;
				if(w[i+p].first==0)
				{
					w[i+p].first=1;
				}
			}
			if(i+q<=n)
			{
				w[i+q].first=w[i].first;
				w[i+q].second=w[i].second+1;
				if(w[i+q].second==0)
				{
					w[i+q].second=1;
				}
			}
		}
	}
	int x = 0;
	if(w[n].first==-1&&w[n].second==-1)
	{
		cout << "-1";
	}
	else
	{

		for(int i = 0 ; i < w[n].first; i++)
		{
			for(int j = 0 ; j < p ; j++)
			{
				cout << a[x];
				x++;
			}
			cout << endl;
		}
		for(int i = 0 ; i < w[n].second; i++)
		{
			for(int j = 0 ; j < q ; j++)
			{
				cout << a[x];
				x++;
			}
			cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <string>

using namespace std;

string s;
int n, p, q;

int main() {
	int a, b;
	cin >> n >> p >> q;
	getline(cin, s);

	a = n / p;
	b = 0;

	while (n != a * p + b * q) {
		if (a == -1) {
			cout << -1 << "\n";
			return 0;
		}
		if (n - a * p - b * q < q) {
			a--;
		} else {
			b++;
		}
	}

	cout << a + b << "\n";
	for (int i = 0; i < a; i++) {
		cout << s.substr(i * p, (i+1) * p) << "\n";
	}
	for (int i = 0; i < b; i++) {
		cout << s.substr(a * p + i * q, a * p + (i+1) * q) << "\n";
	}

	return 0;
}


#include <iostream>
#include <string>

using namespace std;

string s;
int n, p, q;

int main() {
	int a, b;
	cin >> n >> p >> q;
	getline(cin, s);
	getline(cin, s);

	a = n / p;
	b = 0;

	while (n != a * p + b * q) {
		if (a == -1) {
			cout << -1 << "\n";
			return 0;
		}
		if (n - a * p - b * q < q) {
			a--;
		} else {
			b++;
		}
	}

	cout << a + b << "\n";
	for (int i = 0; i < a; i++) {
		cout << s.substr(i * p, p) << "\n";
	}
	for (int i = 0; i < b; i++) {
		cout << s.substr(a * p + i * q, q) << "\n";
	}

	return 0;
}


#include <iostream>
#include <string>

using namespace std;

string s;
int n, p, q;

int main() {
	int a, b;
	cin >> n >> p >> q;
	getline(cin, s);
	getline(cin, s);

	a = n / p;
	b = 0;

	while (n != a * p + b * q) {
		if (a == -1) {
			cout << -1 << "\n";
			return 0;
		}
		if (n - a * p - b * q < q) {
			a--;
		} else {
			b++;
		}
	}

	cout << a + b << "\n";
	for (int i = 0; i < a; i++) {
		cout << s.substr(i * p, (i+1) * p) << "\n";
	}
	for (int i = 0; i < b; i++) {
		cout << s.substr(a * p + i * q, a * p + (i+1) * q) << "\n";
	}

	return 0;
}


#include <iostream>
#include <string>

using namespace std;

string s;
int n, p, q;

int main() {
	int a, b;
	cin >> n >> p >> q;
	cin >> s;

	a = n / p;
	b = 0;

	while (n != a * p + b * q) {
		if (a == -1) {
			cout << -1 << "\n";
			return 0;
		}
		if (n - a * p - b * q < q) {
			a--;
		} else {
			b++;
		}
	}

	cout << a + b << "\n";
	for (int i = 0; i < a; i++) {
		cout << s.substr(i * p, (i+1) * p) << "\n";
	}
	for (int i = 0; i < b; i++) {
		cout << s.substr(a * p + i * q, a * p + (i+1) * q) << "\n";
	}

	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

vector <int> P;

int main(){
	int n, p, g, c = 0;
	string s;
	in >> n >> p >> g >> s;
	P.resize(n);
	if (p <= n || g <= n){
		if (p + g <= n){
		}
	}else{
		out << -1;
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, g, c = 1, prov = 0, x1 = 1, d = 1;
bool check = false;

void dfs(int x = 0, int y = 0){
	if (x + p + y < n && check==false){
		++x1;
		if (x + p + y == n){
			check = true;
			x += p;
		}else{
			dfs(x + p);
		}
	}
	if (x + y + g < n && check==false){
		++d;
		if (x + g + y == n){
			check = true;
			y += g;
		}
		else{
			dfs(y + g);
		}
	}
}
int main(){
	string s;
	cin >> n >> p >> g >> s;
	if (p + g <= n){
		dfs(p,g);
		if (n == g*d + p*x1){
			check = true;
		}
	}
	if (g<=n && check==false){
		while (c*g < n){
			++c;
		}
		if (n % (c*g) == 0){
			check = true;
			prov = 1;
			p = g;
		}else{
			c = 1;
		}
	}
	if (p <= n && check == false){
		while (c*p < n){
			++c;
		}
		if (n % (c*p) == 0){
			check = true;
			prov = 1;
		}
		else{
			c = 1;
		}
	}
	if(check==false){
		cout << -1;
	}
	if (check == true){
		if (prov == 1){
			cout << c << "\n";
			for (int i = 0; i < n;){
				int u = 0;
				while (u < p){
					cout << s[i + u];
					++u;
				}
				i += u;
				cout << "\n";
			}
		}else{
			cout << x1 + d << "\n";
			for (int i = 0; i < n; ++i){
				int u = 0;
				while (x1>0){
					--x1;
					while (u < p){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
				}
				u = 0;
				while (d>0){
					--d;
					while (u < g){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
				}
			}
		}
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, g, c = 1, prov = 0, x1 = 1, d = 1;
bool check = false;

void dfs(int x = 0, int y = 0){
	if (x + y < n && check==false){
		++x1;
		if (x + p + y == n){
			check = true;
			x += p;
		}else{
			dfs(x + p,y);
		}
	}
	if (x + y  < n && check==false){
		++d;
		if (x + g + y == n){
			check = true;
			y += g;
		}
		else{
			dfs(x,y + g);
		}
	}
}
int main(){
	string s;
	cin >> n >> p >> g >> s;
	if (p + g <= n){
		dfs(p,g);
		if (n == g*d + p*x1){
			check = true;
		}
	}
	if (g<=n && check==false){
		while (c*g < n){
			++c;
		}
		if (n % (c*g) == 0){
			check = true;
			prov = 1;
			p = g;
		}else{
			c = 1;
		}
	}
	if (p <= n && check == false){
		while (c*p < n){
			++c;
		}
		if (n % (c*p) == 0){
			check = true;
			prov = 1;
		}
		else{
			c = 1;
		}
	}
	if(check==false){
		cout << -1;
	}
	if (check == true){
		if (prov == 1){
			cout << c << "\n";
			for (int i = 0; i < n;){
				int u = 0;
				while (u < p){
					cout << s[i + u];
					++u;
				}
				i += u;
				cout << "\n";
			}
		}else{
			cout << x1 + d << "\n";
			for (int i = 0; i < n; ++i){
				int u = 0;
				while (x1>0){
					--x1;
					while (u < p){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
					u = 0;
				}
				u = 0;
				while (d>0){
					--d;
					while (u < g){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
					u = 0;
				}
			}
		}
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

vector <int> P;
vector <int> S;

int d, f, n, p, q;

int main(){
	string s;
	bool c = true;
	cin >> n >> p >> q >> s;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < n; ++j){
			if (i*p + j*q == n){
				d = i; f = j;
				break;
			}
		}
	}
	if (p*d + f*q == n){
		cout << f + d << "\n";
		int u = 0;
		while (d > 0){
			while (u < p){
				cout << s[u];
				++u;
			}
			--d;
			u = 0;
			cout << "\n";
		}
		while (f > 0){
			while (u < f){
				cout << s[u];
				++u;
			}
			--f;
			u = 0;
			cout << "\n";
		}
	}else{
		cout << -1;
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, g, c = 1, prov = 0, x1 = 1, d = 1;
bool check = false;

void dfs(int x = 0, int y = 0){
	if (x + y < n && check==false){
		++x1;
		if (x1*p + d*y == n){
			check = true;
			x += p;
		}else{
			dfs(x + p,y);
		}
	}
	if (x + y  < n && check==false){
		++d;
		if (x1*p + d*y == n){
			check = true;
			y += g;
		}
		else{
			dfs(x,y + g);
		}
	}
}
int main(){
	string s;
	cin >> n >> p >> g >> s;
	if (p + g <= n){
		dfs(p,g);
		if (n == g*d + p*x1){
			check = true;
		}
	}
	if (g<=n && check==false){
		while (c*g < n){
			++c;
		}
		if (n % (c*g) == 0){
			check = true;
			prov = 1;
			p = g;
		}else{
			c = 1;
		}
	}
	if (p <= n && check == false){
		while (c*p < n){
			++c;
		}
		if (n % (c*p) == 0){
			check = true;
			prov = 1;
		}
		else{
			c = 1;
		}
	}
	if(check==false){
		cout << -1;
	}
	if (check == true){
		if (prov == 1){
			cout << c << "\n";
			for (int i = 0; i < n;){
				int u = 0;
				while (u < p){
					cout << s[i + u];
					++u;
				}
				i += u;
				cout << "\n";
			}
		}else{
			cout << x1 + d << "\n";
			for (int i = 0; i < n; ++i){
				int u = 0;
				while (x1>0){
					--x1;
					while (u < p){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
					u = 0;
				}
				u = 0;
				while (d>0){
					--d;
					while (u < g){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
					u = 0;
				}
			}
		}
	}
	return 0;
}


//# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream cin("input.txt");
ofstream cout("output.txt");*/

vector <int> P;
vector <int> S;

int d, f, n, p, q, sh;

int main(){
	string s;
	bool c = true;
	cin >> n >> p >> q >> s;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < n; ++j){
			if (i*p + j*q == n){
				d = i; f = j;
				break;
			}
		}
	}
	if (p*d + f*q == n){
		cout << f + d << "\n";
		int u = 0;
		while (d > 0){
			while (u < p){
				cout << s[u+sh];
				++u;
			}
			--d;
			sh += u;
			u = 0;
			cout << "\n";
		}
		while (f > 0){
			while (u < q){
				cout << s[u+sh];
				++u;
			}
			--f;
			sh += u;
			u = 0;
			cout << "\n";
		}
	}else{
		cout << -1;
	}
	return 0;
}


//# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream cin("input.txt");
ofstream cout("output.txt");*/

vector <int> P;
vector <int> S;

int d, f, n, p, q, sh;

int main(){
	string s;
	bool c = true;
	cin >> n >> p >> q >> s;
	for (int i = 0; i < n+1; ++i){
		for (int j = 0; j < n+1; ++j){
			if (i*p + j*q == n){
				d = i; f = j;
				break;
			}
		}
	}
	if (p*d + f*q == n){
		cout << f + d << "\n";
		int u = 0;
		while (d > 0){
			while (u < p){
				cout << s[u+sh];
				++u;
			}
			--d;
			sh += u;
			u = 0;
			cout << "\n";
		}
		while (f > 0){
			while (u < q){
				cout << s[u+sh];
				++u;
			}
			--f;
			sh += u;
			u = 0;
			cout << "\n";
		}
	}else{
		cout << -1;
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, g, c = 1, prov = 0, x1 = 1, d = 1;
bool check = false;

void dfs(int x = 0, int y = 0){
	if (x + p + y < n && check==false){
		++x1;
		if (x + p + y == n){
			check = true;
			x += p;
		}else{
			dfs(x + p);
		}
	}
	if (x + y + g < n && check==false){
		++d;
		if (x + g + y == n){
			check = true;
			y += g;
		}
		else{
			dfs(y + g);
		}
	}
}
int main(){
	string s;
	cin >> n >> p >> g >> s;
	if (p + g <= n){
		dfs(p,g);
		if (n == g*d + p*x1){
			check = true;
		}
	}
	if (g<=n && check==false){
		while (c*g < n){
			++c;
		}
		if (n % (c*g) == 0){
			check = true;
			prov = 1;
			p = g;
		}else{
			c = 1;
		}
	}
	if (p <= n && check == false){
		while (c*p < n){
			++c;
		}
		if (n % (c*p) == 0){
			check = true;
			prov = 1;
		}
		else{
			c = 1;
		}
	}
	if(check==false){
		cout << -1;
	}
	if (check == true){
		if (prov == 1){
			for (int i = 0; i < n;){
				int u = 0;
				while (u < p){
					cout << s[i + u];
					++u;
				}
				i += u;
				cout << "\n";
			}
		}else{
			for (int i = 0; i < n; ++i){
				int u = 0;
				while (x1>0){
					--x1;
					while (u < p){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
				}
				u = 0;
				while (d>0){
					--d;
					while (u < g){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
				}
			}
		}
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

vector <int> P;
vector <int> S;

int d, f, n, p, q, sh = 0;

int main(){
	string s;
	bool c = true;
	cin >> n >> p >> q >> s;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < n; ++j){
			if (i*p + j*q == n){
				d = i; f = j;
				break;
			}
		}
	}
	if (p*d + f*q == n){
		cout << f + d << "\n";
		int u = 0;
		while (d > 0){
			while (u < p){
				cout << s[u+sh];
				++u;
			}
			--d;
			sh += u;
			u = 0;
			cout << "\n";
		}
		while (f > 0){
			while (u < q){
				cout << s[u+sh];
				++u;
			}
			--f;
			sh += u;
			u = 0;
			cout << "\n";
		}
	}else{
		cout << -1;
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

vector <int> P;
vector <int> S;

int d = 0, f = 0, n, p, q;
bool check = true;

void dfs(int x, int y){
	if (d*x + f*y == n){
		check = true;
	}
	if (d*x + f*y <= n){
		++d;
		dfs(x + p, y);
	}
	if (d*x + f*y <= n){
		++f;
		dfs(x, y + q);
	}

}

int main(){
	string s;
	bool c = true;
	cin >> n >> p >> q >> s;
	while (c == true){
		dfs(p, q);
	}
	if (check == true){
		while (d > 0){
			int u = 0;
			while (u < p){
				cout << s[u];
				++u;
			}
			--d;
		}
		while (f > 0){
			int u = 0;
			while (u < f){
				cout << s[u];
				++u;
			}
			--f;
		}
	}
	else{
		cout << -1;
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, g, c = 1, prov = 0, x1 = 1, d = 1;
bool check = false;

void dfs(int x = 0, int y = 0){
	if (x + y < n && check==false){
		++x1;
		if (x + p + y == n){
			check = true;
			x += p;
		}else{
			dfs(x + p,y);
		}
	}
	if (x + y  < n && check==false){
		++d;
		if (x + g + y == n){
			check = true;
			y += g;
		}
		else{
			dfs(x,y + g);
		}
	}
}
int main(){
	string s;
	cin >> n >> p >> g >> s;
	if (p + g <= n){
		dfs(p,g);
		if (n == g*d + p*x1){
			check = true;
		}
	}
	if (g<=n && check==false){
		while (c*g < n){
			++c;
		}
		if (n % (c*g) == 0){
			check = true;
			prov = 1;
			p = g;
		}else{
			c = 1;
		}
	}
	if (p <= n && check == false){
		while (c*p < n){
			++c;
		}
		if (n % (c*p) == 0){
			check = true;
			prov = 1;
		}
		else{
			c = 1;
		}
	}
	if(check==false){
		cout << -1;
	}
	if (check == true){
		if (prov == 1){
			cout << c << "\n";
			for (int i = 0; i < n;){
				int u = 0;
				while (u < p){
					cout << s[i + u];
					++u;
				}
				i += u;
				cout << "\n";
			}
		}else{
			cout << x1 + d << "\n";
			for (int i = 0; i < n; ++i){
				int u = 0;
				while (x1>0){
					--x1;
					while (u < p){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
				}
				u = 0;
				while (d>0){
					--d;
					while (u < g){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
				}
			}
		}
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

vector <int> P;
vector <int> S;

int d, f, n, p, q;

int main(){
	string s;
	bool c = true;
	cin >> n >> p >> q >> s;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < n; ++j){
			if (i*p + j*q == n){
				d = i; f = j;
				break;
			}
		}
	}
	if (p*d + f*q == n){
		cout << f + d << "\n";
		int u = 0;
		while (d > 0){
			while (u < p){
				cout << s[u];
				++u;
			}
			--d;
			u = 0;
			cout << "\n";
		}
		while (f > 0){
			while (u < q){
				cout << s[u];
				++u;
			}
			--f;
			u = 0;
			cout << "\n";
		}
	}else{
		cout << -1;
	}
	return 0;
}


# include <fstream>
# include <iostream>
# include <vector>
# include <cmath>
# include <algorithm>
# include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, g, c = 1, prov = 0, x1 = 1, d = 1;
bool check = false;

void dfs(int x = 0, int y = 0){
	if (x + y < n && check==false){
		++x1;
		if (x1*p + d*y == n){
			check = true;
			x += p;
		}else{
			dfs(x + p,y);
		}
	}
	if (x + y  < n && check==false){
		++d;
		if (x1*p + d*y == n){
			check = true;
			y += g;
		}
		else{
			dfs(x,y + g);
		}
	}
}
int main(){
	string s, t;
	cin >> n >> p >> g >> s;
	if (p + g <= n){
		dfs(p,g);
		if (n == g*d + p*x1){
			check = true;
		}
	}
	if (g<=n && check==false){
		while (c*g < n){
			++c;
		}
		if (n % (c*g) == 0){
			check = true;
			prov = 1;
			p = g;
		}else{
			c = 1;
		}
	}
	if (p <= n && check == false){
		while (c*p < n){
			++c;
		}
		if (n % (c*p) == 0){
			check = true;
			prov = 1;
		}
		else{
			c = 1;
		}
	}
	if(check==false){
		cout << -1;
	}
	if (check == true){
		if (prov == 1){
			cout << c << "\n";
			for (int i = 0; i < n;){
				int u = 0;
				while (u < p){
					cout << s[i + u];
					++u;
				}
				i += u;
				cout << "\n";
			}
		}else{
			cout << x1 + d << "\n";
			for (int i = 0; i < n; ++i){
				int u = 0;
				while (x1>0){
					--x1;
					while (u < p){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
					u = 0;
				}
				u = 0;
				while (d>0){
					--d;
					while (u < g){
						cout << s[i + u];
						++u;
					}
					i += u;
					cout << "\n";
					u = 0;
				}
			}
		}
	}
	return 0;
}


#include <iostream>
#include <string>

#define _ ios::sync_with_stdio(false);

using namespace std;

string input;

int main() { _
	int n, p, q;
	int x = -1, y = -1;
	cin >> n >> p >> q;
	cin >> input;
	for(int i=0; i<n; i++) {
		for(int j=0; j<n; j++) {
			if(p*i + q*j == n) {
				x = i, y = j;
				break;
			}
		}
	}
	if(x == -1 && y == -1)
		cout << -1 << endl;
	else {
		int l = 0;
		cout << (x+y) << '\n';
		while(x) {
			cout << input.substr(l, p) << '\n';
			l += p;
			x--;
		}
		while(y) {
			cout << input.substr(l, q) << '\n';
			l+=q;
			y--;
		}
	}
	return 0;
}


#include <iostream>
#include <string>

#define _ ios::sync_with_stdio(false);

using namespace std;

string input;

int main() { _
	int n, p, q;
	int x = -1, y = -1;
	cin >> n >> p >> q;
	cin >> input;
	for(int i=0; i<=n; i++) {
		for(int j=0; j<=n; j++) {
			if(p*i + q*j == n) {
				x = i, y = j;
				break;
			}
		}
	}
	if(x == -1 && y == -1)
		cout << -1 << endl;
	else {
		int l = 0;
		cout << (x+y) << '\n';
		while(x) {
			cout << input.substr(l, p) << '\n';
			l += p;
			x--;
		}
		while(y) {
			cout << input.substr(l, q) << '\n';
			l+=q;
			y--;
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <stdio.h>
#include <map>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int main() {
#ifdef AIM
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, p, q;
	cin >> n >> p >> q;
	string s;
	cin >> s;
	int a, b;
	for (int a = 0; a < n; ++a) {
		for (int b = 0; b < n; ++b) {
			if (a*p + b*q == n) {
				cout << a + b <<endl;
				int curPos = 0;
				for (int i = 0; i < a; ++i) {
					cout << s.substr(curPos, p) << endl;
					curPos += p;
				}
				for (int i = 0; i < b; ++i) {
					cout << s.substr(curPos, q) << endl;
					curPos += q;
				}
				return 0;
			}
		}
	}
	cout << -1;
	return 0;
}


#include <iostream>
#include <vector>
#include <stdio.h>
#include <map>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int main() {
#ifdef AIM
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, p, q;
	cin >> n >> p >> q;
	string s;
	cin >> s;
	int a, b;
	for (int a = 0; a < n; ++a) {
		for (int b = 0; b < n; ++b) {
			if (a*p + b*q == n) {
				cout << a + b <<endl;
				int curPos = 0;
				for (int i = 0; i < a; ++i) {
					cout << s.substr(curPos, curPos+p) << endl;
					curPos += p;
				}
				for (int i = 0; i < b; ++i) {
					cout << s.substr(curPos, curPos + q) << endl;
					curPos += q;
				}
				return 0;
			}
		}
	}
	cout << -1;
	return 0;
}


#include <iostream>
#include <vector>
#include <stdio.h>
#include <map>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int main() {
#ifdef AIM
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, p, q;
	cin >> n >> p >> q;
	string s;
	cin >> s;
	int a, b;
	for (int a = 0; a <= n; ++a) {
		for (int b = 0; b <= n; ++b) {
			if (a*p + b*q == n) {
				cout << a + b <<endl;
				int curPos = 0;
				for (int i = 0; i < a; ++i) {
					cout << s.substr(curPos, p) << endl;
					curPos += p;
				}
				for (int i = 0; i < b; ++i) {
					cout << s.substr(curPos, q) << endl;
					curPos += q;
				}
				return 0;
			}
		}
	}
	cout << -1;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <math.h>
#include <fstream>
using namespace std;
#define re return
#define LL long long
#define EPS 0.00000000001
#define MOD 1000000000
#define INF 1000000000000000
#define N 2200

LL p, q, n;
char s[N];
char t[N];

int main()
{
#ifndef ONLINE_JUDGE
	ifstream cin("B.in");
	ofstream cout("B.out");
#endif
	cin >> n >> p >> q;
	cin >> s;

	for (int i = 0; i < 100; ++i)if (p*i <= n && (n - p*i) % q == 0) {
		int qi = (n - p*i) / q;
		cout << qi + i<<endl;
		for (int j = 0; j < i; ++j){
			for (int k = 0; k < p; ++k)t[k] = s[k + j*p];
			t[p] = 0;
			cout << t << endl;
		}
		int s0 = p*i;
		qi = (n - p*i) / q;
		for (int j = 0; j < qi; ++j){
			for (int k = 0; k < q; ++k)t[k] = s[s0 + k + j*q];
			t[q] = 0;
			cout << t << endl;
		}
		re 0;
	}
	cout << -1;
	re 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <math.h>
#include <fstream>
using namespace std;
#define re return
#define LL long long
#define EPS 0.00000000001
#define MOD 1000000000
#define INF 1000000000000000
#define N 2200

LL p, q, n;
char s[N];
char t[N];

int main()
{
#ifndef ONLINE_JUDGE
	ifstream cin("B.in");
	ofstream cout("B.out");
#endif
	cin >> n >> p >> q;
	cin >> s;

	for (int i = 0; i < 100; ++i)if (p*i <= n && (n - p*i) % q == 0) {
		for (int j = 0; j < i; ++j){
			for (int k = 0; k < p; ++k)t[k] = s[k + j*p];
			t[p] = 0;
			cout << t << endl;
		}
		int s0 = p*i;
		i = (n - p*i) / q;
		for (int j = 0; j < i; ++j){
			for (int k = 0; k < q; ++k)t[k] = s[s0 + k + j*q];
			t[q] = 0;
			cout << t << endl;
		}
		re 0;
	}
	cout << -1;
	re 0;
}


#include <fstream>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

int n, p, q;
string s;

void rec(vector<int> Ans, int sum, int e) {
	if (n == sum) {
		int c = 0;
		int c1 = 0;
		cout << Ans.size() << endl;
		for (int i = 0; i < Ans.size(); i++) {
			while(c < Ans[i] + c1){
				cout << s[c];
				c++;
			}
			c1 = c;
			cout << endl;
		}
		exit(0);

	}else {
		if (e == 0) {
			sum += p;
			Ans.push_back(p);
		}
		else {
			sum += q;
			Ans.push_back(q);
		}
	}
	if(n >= sum)rec(Ans, sum, 0);
	if(n >= sum)rec(Ans, sum, 1);
}

int main() {
	cin >> n >> p >> q >> s;
	vector<int> Ans;
	rec(Ans,0,0);
	if(Ans.size() == 0)rec(Ans,0,1);
	if(Ans.size() == 0)cout << "-1";
	return 0;
}


#include <fstream>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

int n, p, q;
string s;

void rec(vector<int> Ans, int sum, int e) {
	if (n == sum) {
		int c = 0;
		int c1 = 0;
		for (int i = 0; i < Ans.size(); i++) {
			while(c < Ans[i] + c1){
				cout << s[c];
				c++;
			}
			c1 = c;
			cout << endl;
		}
		exit(0);

	}else {
		if (e == 0) {
			sum += p;
			Ans.push_back(p);
		}
		else {
			sum += q;
			Ans.push_back(q);
		}
	}
	if(n >= sum)rec(Ans, sum, 0);
	if(n >= sum)rec(Ans, sum, 1);
}

int main() {
	cin >> n >> p >> q >> s;
	vector<int> Ans;
	rec(Ans,0,0);
	if(Ans.size() == 0)rec(Ans,0,1);
	if(Ans.size() == 0)cout << "-1";
	return 0;
}


#include <fstream>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

int n, p, q;
string s;

void rec(vector<int> Ans, int sum, int e) {
	if (n == sum) {
		int c = 0;
		int c1 = 0;
		for (int i = 0; i < Ans.size(); i++) {
			while(c < Ans[i] + c1){
				cout << s[c];
				c++;
			}
			c1 = c;
			cout << endl;
		}
		exit(0);

	}else {
		if (e == 0) {
			sum += p;
			Ans.push_back(p);
		}
		else {
			sum += q;
			Ans.push_back(q);
		}
	}
	if(n >= sum)rec(Ans, sum, 0);
	if(n >= sum)rec(Ans, sum, 1);
}

int main() {
	cin >> n >> p >> q >> s;
	vector<int> Ans;
	rec(Ans,0,0);
	rec(Ans,0,1);
	if(Ans.size() == 0)cout << "-1";
	return 0;
}


#include <fstream>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

int n, p, q;
string s;

int main() {
	cin >> n >> p >> q >> s;
	bool b = false;;
	int f, se;
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			if (p * i + q * j == n) {
				f = i;
				se = j;
				b = true;
				break;
			}
		}
		if (b)break;
	}
	if (!b)cout << "-1";
	else {
		cout << f + se << endl;
		int c = 0;
		int c1 = 0;
		for (int i = 0; i < f; i++) {
			while(c < p + c1) {
				cout << s[c];
				c++;
			}
			cout << endl;
			c1 = c;
		}
		for (int i = 0; i < se; i++) {
			while (c < q + c1) {
				cout << s[c];
				c++;
			}
			cout << endl;
			c1 = c;
		}
	}
	return 0;
}


#include<iostream>
#include<string>
#include<cstring>
using namespace std;

int main()
{
    int n, q, p;
    string s;
    while (cin >> n >> p >> q)
    {
        int a, b;
        int i = 0;
        cin >> s;
        for (a = 0; a*p <= n; a++)
        {
            for (b = 0; b*q <= n; b++)
            {
                if (a*p + b*q == n)
                {
                    cout << a + b << endl;
                    for (int j = 0; j < a; j++, i += p)
                        cout << s.substr(i, p) << endl;
                    for (int j = 0; j < b; j++, i += q)
                        cout << s.substr(i, q) << endl;
                    continue;
                }
            }
        }
        cout << -1 << endl;
    }
}


#include<iostream>
#include<string>
#include<cstring>
using namespace std;

int n, p, q, ansn = 0;
int ans[110];
bool isOK = false;
void dfs(int num);
string s;
int main()
{
    while (cin >> n >> p >> q)
    {
        isOK = false;
        ansn = 0;
        cin >> s;
        if ((p + q) == n)
        {
            cout << 2 << endl;
            cout << s.substr(0, p) << endl;
            cout << s.substr(p, q) << endl;
            continue;
        }
        if (n%p == 0)
        {
            cout << n / p << endl;
            for (int i = 0; i < n; i += p)
            {
                cout << s.substr(i, p) << endl;
            }
            continue;

        }
        if (n&q == 0)
        {
            cout << n / q << endl;
            for (int i = 0; i < n; i += q)
            {
                cout << s.substr(i, q);
            }
            continue;
        }
        dfs(0);
        if (isOK)
        {
            cout << ansn << endl;
            for (int i = 1, j = 0; i <= ansn; i++)
            {
                cout << s.substr(j, ans[i]) << endl;
                j += ans[i];
            }
        }
        else {
            cout << -1 << endl;
        }
    }
}

void dfs(int num)//num为当前 的数
{
    if (!isOK)
    {
        if (num == n) //当num== n 意味着能完全分割
        {
            isOK = true;
            return;
        }
        else {
            num += p;
            if (num <= n)
            {
                ansn++;
                ans[ansn] = p;
                dfs(num);
                if (isOK) return;
                ansn--;
                num -= p;

            }
            else
                num -= p;
            num += q;
            if (num <= n)
            {
                ansn++;
                ans[ansn] = q;
                dfs(num);
                if (isOK)return;

                ansn--;
                num -= q;

            }
            else
                num -= q;
        }
    }
}


#include<iostream>
#include<string>
#include<cstring>
using namespace std;

int n, p, q, ansn = 0;
int ans[110];
bool isOK = false;
void dfs(int num);
string s;
int main()
{
	while (cin >> n >> p >> q)
	{
		isOK = false;
		ansn = 0;
		cin >> s;
		if ((p + q) == n)
		{
			cout << 2 << endl;
			cout << s.substr(0, p) << endl;
			cout << s.substr(p, q) << endl;
			continue;
		}
		dfs(0);
		if (isOK)
		{
			cout << ansn << endl;
			for (int i = 1, j = 0; i <= ansn; i++)
			{
				cout << s.substr(j, ans[i]) << endl;
				j += ans[i];
			}
		}
		else {
			cout << -1 << endl;
		}
	}
}

void dfs(int num)//numΪ��ǰ ����
{
	if (!isOK)
	{
		if (num == n) //��num== n ��ζ������ȫ�ָ�
		{
			isOK = true;
			return;
		}
		else {
			num += p;
			if (num <= n)
			{
				ansn++;
				ans[ansn] = p;
				dfs(num);
				if (isOK) return;
				ansn--;
				num -= p;

			}
			else
				num -= p;
			num += q;
			if (num <= n)
			{
				ansn++;
				ans[ansn] = q;
				dfs(num);
				if (isOK)return;

				ansn--;
				num -= q;

			}
			else
				num -= q;
		}
	}
}


#include<iostream>
#include<string>
#include<cstring>
using namespace std;

int main()
{
    int n, q, p;
    string s;
    bool isOK;
    while (cin >> n >> p >> q)
    {
        int a, b;
        isOK = false;
        int i = 0;
        cin >> s;
        for (a = 0; a*p <= n; a++)
        {
            for (b = 0; b*q <= n; b++)
            {
                if (a*p + b*q == n)
                {
                    cout << a + b << endl;
                    for (int j = 0; j < a; j++, i += p)
                        cout << s.substr(i, p) << endl;
                    for (int j = 0; j < b; j++, i += q)
                        cout << s.substr(i, q) << endl;
                    isOK = true;
                    goto OK;
                }
            }
        }
        OK:
        if(!isOK)
        cout << -1 << endl;
    }
}


#include<iostream>
#include<string>
#include<cstring>
using namespace std;

int n, p, q, ansn = 0;
int ans[110];
bool isOK = false;
void dfs(int num);
string s;
int main()
{
    while (cin >> n >> p >> q)
    {
        isOK = false;
        ansn = 0;
        cin >> s;
        if ((p + q) == n)
        {
            cout << 2 << endl;
            cout << s.substr(0, p) << endl;
            cout << s.substr(p, q) << endl;
            continue;
        }
        if (n%p == 0)
        {
            cout << n / p << endl;
            for (int i = 0; i < n; i += p)
            {
                cout << s.substr(i, p);
            }
            continue;

        }
        if (n&q == 0)
        {
            cout << n / q << endl;
            for (int i = 0; i < n; i += q)
            {
                cout << s.substr(i, q);
            }
            continue;
        }
        dfs(0);
        if (isOK)
        {
            cout << ansn << endl;
            for (int i = 1, j = 0; i <= ansn; i++)
            {
                cout << s.substr(j, ans[i]) << endl;
                j += ans[i];
            }
        }
        else {
            cout << -1 << endl;
        }
    }
}

void dfs(int num)//num为当前 的数
{
    if (!isOK)
    {
        if (num == n) //当num== n 意味着能完全分割
        {
            isOK = true;
            return;
        }
        else {
            num += p;
            if (num <= n)
            {
                ansn++;
                ans[ansn] = p;
                dfs(num);
                if (isOK) return;
                ansn--;
                num -= p;

            }
            else
                num -= p;
            num += q;
            if (num <= n)
            {
                ansn++;
                ans[ansn] = q;
                dfs(num);
                if (isOK)return;

                ansn--;
                num -= q;

            }
            else
                num -= q;
        }
    }
}


#include<iostream>
#include<string>

using namespace std;

int main()
{
	string str;

	bool flag=false;
	int n,p,q;
	cin>>n>>p>>q;
	cin>>str;
	for(int i=0;i<n;i++)
	{
		if((n-i*p)%q==0)
		{
			cout<<i+((n-i*p)/q)<<endl;

			for(int k=0;k<i;k+=p)
				cout<<str.substr(k,p)<<endl;
			for(int y=i*p;y<n;y+=q)
				cout<<str.substr(y,q)<<endl;
			flag=true;
			break;
		}
	}
	if(!flag)
		cout<<-1<<endl;

	return 0;
}


#include<iostream>
#include<string>

using namespace std;

int main()
{
	string str;

	bool flag=false;
	int n,p,q;
	cin>>n>>p>>q;
	cin>>str;
	for(int i=0;i<n;i++)
	{
		if((n-i*p)%q==0 && (n-i*p)>=0)
		{
			int j=(n-i*p)/q;
			cout<<i+j<<endl;
			int indx=0;
			for(int k=0;k<i;k++)
			{
				cout<<str.substr(indx,p)<<endl;
				indx+=p;
			}
			for(int y=0;y<j;y++)
			{
				cout<<str.substr(indx,q)<<endl;
				indx+=q;
			}
			flag=true;
			break;
		}
	}
	if(!flag)
		cout<<-1<<endl;

	return 0;
}


#include<iostream>
#include<string>

using namespace std;

int main()
{
	string str;

	bool flag=false;
	int n,p,q;
	cin>>n>>p>>q;
	cin>>str;
	for(int i=0;i<n;i++)
	{
		if((n-i*p)%q==0 && (n-i*p)>=0)
		{
			cout<<i+((n-i*p)/q)<<endl;

			for(int k=0;k<i;k+=p)
				cout<<str.substr(k,p)<<endl;
			for(int y=i*p;y<n;y+=q)
				cout<<str.substr(y,q)<<endl;
			flag=true;
			break;
		}
	}
	if(!flag)
		cout<<-1<<endl;

	return 0;
}


#include<cstdio>
#include<cstring>
char s[100000];
int main(void){
    int len,n,a,b,i;
    while(scanf("%d %d %d",&n,&a,&b)!=EOF){
        getchar();
        gets(s);
        if(a+b==n||2*a==n){
            printf("2\n");
            for(i=0;i<a;i++){
                printf("%c",s[i]);
            }
            printf("\n");
            for(;i<n;i++){
                printf("%c",s[i]);
            }
            printf("\n");
        }
        else if(2*b==n){
            printf("2\n");
            for(i=0;i<b;i++){
                printf("%c",s[i]);
            }
            printf("\n");
            for(;i<n;i++){
                printf("%c",s[i]);
            }
            printf("\n");
        }
        else printf("-1\n");
    }
}


#include <iostream>
using namespace std;
int n, p, q, x, y, m, t;
char S[100];
int main()
{
    cin>> n>> p>> q;
    for (int i=0; i<n; i++)
        cin>> S[i];
    m=n/p;
    for (int i=0; i<=m; i++)
    {
        if ((n-(p*i))%q==0)
        {
            y=(n-p*i)/q;
            x=i;

            break;
        }
    }
    cout<< x+y<< endl;
    for (int i=0; i<x; i++)
    {
        for (int j=0; j<p; j++)
        {
            cout<< S[t];
            t++;
        }
        cout<< endl;
    }
    for (int i=0; i<y; i++)
    {
        for (int j=0; j<q; j++)
        {
            cout<< S[t];
            t++;
        }
        cout<< endl;
    }
    return 0;
}


#include <iostream>
using namespace std;
int n, p, q, x, y, m, t, g;
char S[100];
int main()
{
    cin>> n>> p>> q;
    for (int i=0; i<n; i++)
        cin>> S[i];
    m=n/p;
    for (int i=0; i<=m; i++)
    {
        if ((n-(p*i))%q==0)
        {
            y=(n-p*i)/q;
            x=i;
            g=1;
            break;
        }
    }
    if (g==1)
        cout<< x+y<< endl;
    else
        cout<< -1;
    for (int i=0; i<x; i++)
    {
        for (int j=0; j<p; j++)
        {
            cout<< S[t];
            t++;
        }
        cout<< endl;
    }
    for (int i=0; i<y; i++)
    {
        for (int j=0; j<q; j++)
        {
            cout<< S[t];
            t++;
        }
        cout<< endl;
    }
    return 0;
}


#include <iostream>
#include <string>
using namespace std;

string s;
int n,p,q;
int main() {
//	freopen("f.txt","r",stdin);
	cin >> n >> p >> q;
	cin >> s;
	bool ok = 0;
	if(n % p == 0) {
		ok = 1;
		printf("%d\n",n / p);
		for(int i = 0; i < n; i++)
			if(i != 0 && i % p == 0)
				putchar('\n'),
				putchar(s[i]);
			else
				putchar(s[i]);
	}
	else
		if(n % q == 0) {
			ok = 1;
			printf("%d\n",n / q);
			for(int i = 0; i < n; i++)
				if(i != 0 && i % q == 0)
					putchar('\n'),
					putchar(s[i]);
				else
					putchar(s[i]);
		}
		else
			if((n - q) % p == 0) {
				ok = 1;
				printf("%d\n",(n - q) / p + 1);
				for(int i = 0; i < n - q; i++)
					if(i != 0 && i % p == 0)
						putchar('\n'),
						putchar(s[i]);
					else
						putchar(s[i]);
				putchar('\n');
				for(int i = n - q; i < n; i++)
					putchar(s[i]);
			}
			else
				if((n - p) % q == 0 ) {
				ok = 1;
				printf("%d\n",(n - p) / q + 1);
				for(int i = 0; i < n - p; i++)
					if(i != 0 && i % q == 0)
						putchar('\n'),
						putchar(s[i]);
					else
						putchar(s[i]);
				putchar('\n');
				for(int i = n - p; i < n; i++)
					putchar(s[i]);
			}
		if(ok == 0)
			printf("-1\n");

	return 0;
}


#include <iostream>
#include <string>
using namespace std;

string s;
int n,p,q;
int main() {
//	freopen("f.txt","r",stdin);
	cin >> n >> p >> q;
	cin >> s;
	bool ok = 0;
	if(n % p == 0) {
		ok = 1;
		for(int i = 0; i < n; i++)
			if(i != 0 && i % p == 0)
				putchar('\n'),
				putchar(s[i]);
			else
				putchar(s[i]);
	}
	else
		if(n % q == 0) {
			ok = 1;
			for(int i = 0; i < n; i++)
				if(i != 0 && i % q == 0)
					putchar('\n'),
					putchar(s[i]);
				else
					putchar(s[i]);
		}
		else
			if((n - q) % p == 0) {
				ok = 1;
				for(int i = 0; i < n - q; i++)
					if(i != 0 && i % p == 0)
						putchar('\n'),
						putchar(s[i]);
					else
						putchar(s[i]);
				putchar('\n');
				for(int i = n - q; i < n; i++)
					putchar(s[i]);
			}
			else
				if((n - p) % q == 0 ) {
				ok = 1;
				for(int i = 0; i < n - p; i++)
					if(i != 0 && i % q == 0)
						putchar('\n'),
						putchar(s[i]);
					else
						putchar(s[i]);
				putchar('\n');
				for(int i = n - p; i < n; i++)
					putchar(s[i]);
			}
		if(ok == 0)
			printf("-1\n");

	return 0;
}


#include <iostream>
#include <string>
using namespace std;

string s;
int n,p,q;
int main() {
//	freopen("f.txt","r",stdin);
	cin >> n >> p >> q;
	cin >> s;

	bool ok = 1;
	int k1 = 0,k2 = 0,i1 = 0,i2 = 0;
	for(; ok == 1 && k1 <= n / p; k1++) {
		for(k2 = 0; ok == 1 && k2 <= n / q; k2++) {
			if(k1 * p + k2 * q == n) {
				ok = 0;
				i1 = k1,i2 = k2;
				break;
			}
		}

	}
	if(ok == 1)
		printf("-1\n");
	else {
		printf("%d\n",i1 + i2);
		for(int i = 1; i <= i1 * p; i++) {
			printf("%c",s[i - 1]);
			if(i % (p) == 0)
				printf("\n");
		}
		for(int i = 1; i <= n - i1 * p; i++) {
			printf("%c",s[i + i1 * p - 1]);
			if(i && i % (q) == 0)
				printf("\n");
		}
	}
/*	if(n % p == 0) {
		ok = 1;
		printf("%d\n",n / p);
		for(int i = 0; i < n; i++)
			if(i != 0 && i % p == 0)
				putchar('\n'),
				putchar(s[i]);
			else
				putchar(s[i]);
	}
	else
		if(n % q == 0) {
			ok = 1;
			printf("%d\n",n / q);
			for(int i = 0; i < n; i++)
				if(i != 0 && i % q == 0)
					putchar('\n'),
					putchar(s[i]);
				else
					putchar(s[i]);
		}
		else
			if((n - q) % p == 0) {
				ok = 1;
				printf("%d\n",(n - q) / p + 1);
				for(int i = 0; i < n - q; i++)
					if(i != 0 && i % p == 0)
						putchar('\n'),
						putchar(s[i]);
					else
						putchar(s[i]);
				putchar('\n');
				for(int i = n - q; i < n; i++)
					putchar(s[i]);
			}
			else
				if((n - p) % q == 0 ) {
				ok = 1;
				printf("%d\n",(n - p) / q + 1);
				for(int i = 0; i < n - p; i++)
					if(i != 0 && i % q == 0)
						putchar('\n'),
						putchar(s[i]);
					else
						putchar(s[i]);
				putchar('\n');
				for(int i = n - p; i < n; i++)
					putchar(s[i]);
			}
		if(ok == 0)
			printf("-1\n");
			*/
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n, p, q;
	string s;
	cin >> n >> p >> q;
	cin >> s;
	int i = 0;
	bool ok = false;
	while (n - p*i >= 0)
	{
		if ((n - p*i) % q == 0)
		{
			ok = true;
			cout << i + (n - p*i) / q<<endl;
			int j = 0;
			while (j < p*i)
			{
				cout << s[j];
				if ((j+1)%p == 0)
					cout << endl;
				j++;
			}
			while (j < n)
			{
				cout << s[j];
				if ((j+1-p*i)%q == 0)
					cout << endl;
				j++;
			}
			break;
		}
		i++;
	}
	if (!ok)
		cout << -1;
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n, p, q;
	string s;
	cin >> n >> p >> q;
	cin >> s;
	int i = 0;
	bool ok = false;
	while (n - p*i > 0)
	{
		if ((n - p*i) % q == 0)
		{
			ok = true;
			int j = 0;
			while (j < p*i)
			{
				cout << s[j];
				if ((j+1)%p == 0)
					cout << endl;
				j++;
			}
			while (j < n)
			{
				cout << s[j];
				if ((j+1-p*i)%q == 0)
					cout << endl;
				j++;
			}
			break;
		}
		i++;
	}
	if (!ok)
		cout << -1;
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n, p, q;
	string s;
	cin >> n >> p >> q;
	cin >> s;
	int i = 0;
	bool ok = false;
	while (n - p*i > 0)
	{
		if ((n - p*i) % q == 0)
		{
			ok = true;
			cout << i + (n - p*i) / q<<endl;
			int j = 0;
			while (j < p*i)
			{
				cout << s[j];
				if ((j+1)%p == 0)
					cout << endl;
				j++;
			}
			while (j < n)
			{
				cout << s[j];
				if ((j+1-p*i)%q == 0)
					cout << endl;
				j++;
			}
			break;
		}
		i++;
	}
	if (!ok)
		cout << -1;
	return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
//ifstream cin("input.txt");
//ofstream cout("output.txt");
string s;
int main()
{
	int n, x, y, i = 0, j = 0;
	cin >> n >> x >> y >> s;
	for (i = 0; i * x <= n; ++i)
		for (j = 0; i * x + j * y <= n; ++j)
		{
			if (i * x + j * y == n)
			{
				cout << i + j <<endl;
				for (int k = 0; k < i; ++k)
				{
					for (int z = 0; z < x; ++z)
						cout << s[k*x + z];
					cout << endl;
				}

				for (int k = 0; k < j; ++k){
					for (int z = 0; z < y; ++z)
					cout << s[i* x + k*y + z];

					cout << endl;
				}
			return 0;
			}
		}
	cout <<-1;
	return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
//ifstream cin("input.txt");
//ofstream cout("output.txt");
string s;
int main()
{
	int n, x, y, i = 0, j = 0;
	cin >> n >> x >> y >> s;
	for (i = 0; i * x <= n; ++i)
		for (j = 0; i * x + j * y <= n; ++j)
		{
			if (i * x + j * y == n)
			{
				for (int k = 0; k < i; ++k)
				{
					for (int z = 0; z < x; ++z)
						cout << s[k*x + z];
					cout << endl;
				}

				for (int k = 0; k < j; ++k){
					for (int z = 0; z < y; ++z)
					cout << s[i* x + k*y + z];

					cout << endl;
				}
			return 0;
			}
		}
	cout <<-1;
	return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, q, ans = 0;
string s;
bool b = false;
int main()
{
	cin >> n >> p >> q >> s;
	int k = 0, l = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			if (i* p + j * q == n)
			{
				ans = i + j;
				k = i; l = j;
				b = true;
				break;
			}
		}
		if (b) break;
	}
	if (b)
	{
		cout << ans << endl;
		int j = 0;
		for (int i = 0; i < k * p; ++i)
		{
			if (j == p) { j = 0; cout << endl; }
			if (j < p) {
				 cout<<s[i];
			}
			j++;
		}
		j = 0;
		if (k != 0)	cout << endl;
		for (int i = k * p; i < l * q + k * p; ++i)
		{
			if (j == q) { j = 0; cout << endl; }
			if (j < q) {
				cout << s[i];
			}
			j++;
		}
	}
	else
	{
		cout << -1;
	}
	return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace std;

/*ifstream in("input.txt");
ofstream out("output.txt");*/

int n, p, q, ans = 0, j = 0;
string s;

int main()
{
	cin >> n >> p >> q >> s;
	int k = n;
	if (n % p == 0)
	{
		ans = n / p;
		cout << ans << endl;
		for (int i = 0; i < k; ++i, ++j)
		{
			if (j == p)
			{
				cout << endl;
				j = 0;
			}
			cout << s[i];
		}
	}
	else if (n % q == 0)
	{
		ans = n / q;
		cout << ans << endl;
		for (int i = 0; i < k; ++i, ++j)
		{
			if (j == q)
			{
				cout << endl;
				j = 0;
			}
			cout << s[i];
		}
	}
	else if (n % (p + q) == 0)
	{
		int z = 0;
		ans = n / (p + q) * 2;
		cout << ans << endl;
		for (int i = 0; i < k; ++i)
		{
			if (j == p)
			{
				cout << endl;
				z = 0;
			}
			else if (z == q) {
				cout << endl;
				j = 0;
			}
			cout << s[i];
			z++; j++;
		}
	}
	else
	{
		cout << -1;
	}
	return 0;
}