#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Cell
{
public:
    int value;
    list<Cell*> to;
    bool candidate;

    Cell(int value0){
        value = value0;
    }
    ~Cell(){
        list<Cell*>::iterator it = to.begin();
        while(it != to.end()){
            (*it)->to.erase(find((*it)->to.begin(), (*it)->to.end(), this));
            delete *it;
            ++ it;
        }
    }

    void updateValue()
    {
        long long a = value;
        a *= 3;
        ++ a;
        while(a % 2 == 0)
            a /= 2;
        -- a;
        a %= 12345678;
        ++ a;
        candidate = (a > value);
        value = a;
    }

    void update(Cell* prev)
    {
        updateValue();
        candidate &= (to.size() == 0 || (prev != NULL && to.size() == 1));

        if(value == 1){
            if(prev != NULL && to.size() == 2){
                list<Cell*>::iterator it = to.begin();
                if(*it == prev)
                    ++ it;
                prev->to.push_back(*it);
                *find((*it)->to.begin(), (*it)->to.end(), this) = prev;
                to.erase(it);
            }
            return;
        }

        list<Cell*>::iterator it = to.begin();
        while(it != to.end()){
            if(*it != prev){
                (*it)->update(this);
                if((*it)->value == 1){
                    (*it)->to.erase(find((*it)->to.begin(), (*it)->to.end(), this));
                    delete *it;
                    it = to.erase(it);
                }else{
                    ++ it;
                }
            }else{
                ++ it;
            }
        }

        if(candidate){
            int a = (value + 1) / 2;
            if(a % 2 == 0)
                ++ a;
            Cell* c = new Cell(a);
            c->to.push_back(this);
            to.push_back(c);
        }
    }

    static Cell* maxCell;
    static int maxValue;
    static bool ng;
    int findMax(Cell* prev)
    {
        if(value > maxValue){
            maxValue = value;
            maxCell = this;
            ng = false;
        }else if(value == maxValue){
            ng = true;
        }

        int num = 1;
        list<Cell*>::iterator it = to.begin();
        while(it != to.end()){
            if(*it != prev){
                num += (*it)->findMax(this);
            }
            ++ it;
        }

        return num;
    }

    void addLeaderBonus()
    {
        int a = (value + 1) / 2;
        if(a % 2 == 0)
            -- a;
        Cell* c = new Cell(a);
        c->to.push_back(this);
        to.push_back(c);
    }
};
Cell* Cell::maxCell;
int Cell::maxValue;
bool Cell::ng;

Cell* leader;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        leader = new Cell(n);
        int t = 0;
        int ret = 1;
        for(;;){
            ++ t;
            leader->update(NULL);
            if(leader->value == 1)
                break;

            Cell::maxValue = -1;
            int num = leader->findMax(NULL);
            if(!Cell::ng){
                leader = Cell::maxCell;
                leader->addLeaderBonus();
                ++ num;
            }
            ret = max(ret, num);
        }

        cout << t << ' ' << ret << endl;

        delete leader;
    }
}