#include #include using namespace std; int main(){ int n,m;cin>>n>>m; vector A; while(!(n==0 || m==0)){ A.push_back(n/m);n%=m;swap(n,m); } for(int i = 0; A.size() > i; i++){ cout << A[i] << " \n"[i+1 == A.size()]; } }