#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
int extgcd(int a, int b, int& x, int& y) {
if (b == 0) {
x = 1, y = 0;
return a;
}
int d = extgcd(b, a % b, y, x);
y -= a / b * x;
return d;
}
vector<pair<int, int>> findPositiveSolution(int a, int b, int c) {
int gd, x0, y0;
gd = extgcd(a, b, x0, y0);
if (c % gd != 0) {
return {};
}
int factor = c / gd;
x0 *= factor;
y0 *= factor;
int a_d = a / gd;
int b_d = b / gd;
int k1 = ceil((double )(-x0) / b_d);
int k2 = floor((double )y0 / a_d);
if (k1 > k2) {
return {};
}
vector<pair<int, int>> res;
for (int k = k1; k <= k2; k++) {
int x = x0 + b_d * k;
int y = y0 - a_d * k;
if (x >= 0 and y >= 0) {
res.emplace_back(x, y);
}
}
return res;
}
int main() {
auto res = findPositiveSolution(3, 5, 120);
if (res.empty()) {
cout << "No solution" << endl;
return 0;
}
for (auto [x, y] : res) {
cout << x << " " << y << endl;
}
}