function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;
    this.CLEAR_ARRAY_PER_CASE = false;

    this.solveCase = function() {
        var res , i , j , fl , cn , temp , lo , hi , mi , fl , crr ;
        res = 0 ;
        lo = 0 ;
        hi = 1000000000000000 ;
        while( lo <= hi ) {
        	mi = Math.floor( ( lo + hi ) / 2 ) ;
        	for( i = 0 ; i <= this.m ; i++ ) {
        		this.brr[ i ] = mi ;
        	}
        	crr = [] ;
        	for( i = 0 ; i < this.n ; i++ ) {
        		crr.push( this.arr[ i ] ) ;
        	}
        	j = this.m ;
        	fl = 1 ;
        	for( i = this.n - 1 ; i >= 0 ; i-- ) {
        		if( fl == 0 ) {
        			break ;
        		}
        		while( true ) {
        			if( crr[ i ] > 0 ) {
        				if( j <= 0 ) {
        					fl = 0 ;
        					break ;
        				}
        				if( this.brr[ j ] == 0 ) {
        					j-- ;
        					continue ;
        				}
        				if( this.brr[ j ] == mi ) {
        					if( this.brr[ j ] < i + 1 ) {
        						this.brr[ j ] = 0 ;
        						j-- ;
        						continue ;
        					}
        					this.brr[ j ] -= i + 1 ;
        				}
        				if( this.brr[ j ] == 0 ) {
        					j-- ;
        					continue ;
        				}
        				if( this.brr[ j ] <= crr[ i ] ) {
        					crr[ i ] -= this.brr[ j ] ;
        					this.brr[ j ] = 0 ;
        					j-- ;
        				}
        				else {
        					this.brr[ j ] -= crr[ i ] ;
        					crr[ i ] = 0 ;
        				}
        			}
        			else {
        				break ;
        			}
        		}
        	}
        	for( i = this.n - 1 ; i >= 0 ; i-- ) {
        		if( crr[ i ] > 0 ) {
        			fl = 0 ;
        			break ;
        		}
        	}
        	if( fl == 1 ) {
    			hi = mi - 1 ;
    			res = mi ;
    		}
    		else {
    			lo = mi + 1 ;
    		}
        }
        print( res ) ;
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            this.m = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
                this.arr.push( irObj.nextInt() ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.adjList = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.adjList.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adjList = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adjList.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            res = "";
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );
                }
            }
            this.currrentCharacterIndex = endIdx;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        return this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();

// GukiZ

function main_1(){
    var n = parseInt(readline());
    var ans = 0;
    while (n--) {
        var nums = readline().split(' ').map(Number);
        ans += (nums[2] - nums[0] + 1) * (nums[3] - nums[1] + 1);
    }
    print(ans);
}

function main(){
    var line  = readline();
    //var line = prompt();
    var n = line.length;
    //alert(line);
    var m = 0;
    for(i=0;i<n;i+=2){
        for(j=i+1;j<n;j+=2){
            var ex = [line.slice(0, i), '(', line.slice(i,j) , ')' , line.slice(j)].join('');
            m = Math.max(m,eval(ex));
        }
    }
    print(m);
}

// var n = parseInt(readline());
var input_line = readline().split(' ').map(Number);
var n = input_line[0];
var m = input_line[1];

var arr = readline().split(' ').map(Number);

while (arr[n-1] == 0) {
    arr.pop();
    n --;
}
/*
n = m = 100000;
for (i=0; i < n; i++) {
    arr[$i] = '10';
}
*/

var o_min = 0;
var o_max = 1000000000000000;

var time = 0;
var arr_kor = [];
var posNotNull = 0;
var time_tmp = 0;

while (o_max - o_min > 1) {

    time = Math.round((o_min + o_max) / 2);

    arr_kor = arr.slice();
    posNotNull = 0;
    for (i=1; i <= m; i++) {

        time_tmp = time - posNotNull;
        for (j=posNotNull; j < n; j++) {
            time_tmp --;

            if (arr_kor[j] == 0) {
                posNotNull ++;
                continue;
            }

            if (arr_kor[j] < time_tmp) {
                time_tmp -= arr_kor[j];
                arr_kor[j] = 0;
            } else {
                arr_kor[j] -= time_tmp;
                break;
            }
        }
        if (arr_kor[n-1] == 0) break;
    }

    if (arr_kor[n-1] == 0) {
        o_max = time;
    } else {
        o_min = time;
    }

}

print(o_max);

function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;
    this.CLEAR_ARRAY_PER_CASE = false;

    this.solveCase = function() {
        var res , i , j , fl , cn , temp , lo , hi , mi , fl , crr ;
        res = 0 ;
        lo = 0 ;
        hi = 100000000000000 ;
        while( lo <= hi ) {
        	mi = Math.floor( ( lo + hi ) / 2 ) ;
        	for( i = 0 ; i <= this.m ; i++ ) {
        		this.brr[ i ] = mi ;
        	}
        	crr = [] ;
        	for( i = 0 ; i < this.n ; i++ ) {
        		crr.push( this.arr[ i ] ) ;
        	}
        	j = this.m ;
        	fl = 1 ;
        	for( i = this.n - 1 ; i >= 0 ; i-- ) {
        		if( fl == 0 ) {
        			break ;
        		}
        		while( true ) {
        			if( crr[ i ] > 0 ) {
        				if( j <= 0 ) {
        					fl = 0 ;
        					break ;
        				}
        				if( this.brr[ j ] == 0 ) {
        					j-- ;
        					continue ;
        				}
        				if( this.brr[ j ] == mi ) {
        					if( this.brr[ j ] < i + 1 ) {
        						this.brr[ j ] = 0 ;
        						j-- ;
        						continue ;
        					}
        					this.brr[ j ] -= i + 1 ;
        				}
        				if( this.brr[ j ] == 0 ) {
        					j-- ;
        					continue ;
        				}
        				if( this.brr[ j ] <= crr[ i ] ) {
        					crr[ i ] -= this.brr[ j ] ;
        					this.brr[ j ] = 0 ;
        					j-- ;
        				}
        				else {
        					this.brr[ j ] -= crr[ i ] ;
        					crr[ i ] = 0 ;
        				}
        			}
        			else {
        				break ;
        			}
        		}
        	}
        	for( i = this.n - 1 ; i >= 0 ; i-- ) {
        		if( crr[ i ] > 0 ) {
        			fl = 0 ;
        			break ;
        		}
        	}
        	if( fl == 1 ) {
    			hi = mi - 1 ;
    			res = mi ;
    		}
    		else {
    			lo = mi + 1 ;
    		}
        }
        print( res ) ;
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            this.m = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
                this.arr.push( irObj.nextInt() ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.adjList = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.adjList.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adjList = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adjList.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            res = "";
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );
                }
            }
            this.currrentCharacterIndex = endIdx;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        return this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();

// GukiZ

function main_1(){
    var n = parseInt(readline());
    var ans = 0;
    while (n--) {
        var nums = readline().split(' ').map(Number);
        ans += (nums[2] - nums[0] + 1) * (nums[3] - nums[1] + 1);
    }
    print(ans);
}

function main(){
    var line  = readline();
    //var line = prompt();
    var n = line.length;
    //alert(line);
    var m = 0;
    for(i=0;i<n;i+=2){
        for(j=i+1;j<n;j+=2){
            var ex = [line.slice(0, i), '(', line.slice(i,j) , ')' , line.slice(j)].join('');
            m = Math.max(m,eval(ex));
        }
    }
    print(m);
}

// var n = parseInt(readline());
var input_line = readline().split(' ').map(Number);
var n =  input_line[0];
var m =  input_line[1];

var arr = readline().split(' ').map(Number);

while (arr[n-1] == 0) {
    arr.pop();
    n --;
}
/*
n = m = 100000;
for (i=0; i < n; i++) {
    arr[$i] = '10';
}
*/

var o_min = 0;
var o_max = 385000000;

var time = 0;
var arr_kor = [];
var posNotNull = 0;
var time_tmp = 0;

while (o_max - o_min > 1) {

    time = Math.round((o_min + o_max) / 2);

    arr_kor = arr;
    posNotNull = 0;
    for (i=1; i <= m; i++) {

        time_tmp = time - posNotNull;
        for (j=posNotNull; j < n; j++) {
            time_tmp --;

            if (arr_kor[j] == 0) {
                posNotNull ++;
                continue;
            }

            if (arr_kor[j] < time_tmp) {
                time_tmp -= arr_kor[j];
                arr_kor[j] = 0;
            } else {
                arr_kor[j] -= time_tmp;
                break;
            }
        }
        if (arr_kor[n-1] == 0) break;
    }

    if (arr_kor[n-1] == 0) {
        o_max = time;
    } else {
        o_min = time;
    }

}

print(o_max);

// GukiZ

function main_1(){
    var n = parseInt(readline());
    var ans = 0;
    while (n--) {
        var nums = readline().split(' ').map(Number);
        ans += (nums[2] - nums[0] + 1) * (nums[3] - nums[1] + 1);
    }
    print(ans);
}

function main(){
    var line  = readline();
    //var line = prompt();
    var n = line.length;
    //alert(line);
    var m = 0;
    for(i=0;i<n;i+=2){
        for(j=i+1;j<n;j+=2){
            var ex = [line.slice(0, i), '(', line.slice(i,j) , ')' , line.slice(j)].join('');
            m = Math.max(m,eval(ex));
        }
    }
    print(m);
}

// var n = parseInt(readline());
var input_line = readline().split(' ').map(Number);
var n =  input_line[0];
var m =  input_line[1];

var arr = readline().split(' ').map(Number);

while (arr[n-1] == 0) {
    arr.pop();
    n --;
}
/*
n = m = 100000;
for (i=0; i < n; i++) {
    arr[$i] = '10';
}
*/

var o_min = 0;
var o_max = 2000000000;

var time = 0;
var arr_kor = [];
var posNotNull = 0;
var time_tmp = 0;

while (o_max - o_min > 1) {

    time = Math.round((o_min + o_max) / 2);

    arr_kor = arr.slice();
    posNotNull = 0;
    for (i=1; i <= m; i++) {

        time_tmp = time - posNotNull;
        for (j=posNotNull; j < n; j++) {
            time_tmp --;

            if (arr_kor[j] == 0) {
                posNotNull ++;
                continue;
            }

            if (arr_kor[j] < time_tmp) {
                time_tmp -= arr_kor[j];
                arr_kor[j] = 0;
            } else {
                arr_kor[j] -= time_tmp;
                break;
            }
        }
        if (arr_kor[n-1] == 0) break;
    }

    if (arr_kor[n-1] == 0) {
        o_max = time;
    } else {
        o_min = time;
    }

}

print(o_max);

// GukiZ

function main_1(){
    var n = parseInt(readline());
    var ans = 0;
    while (n--) {
        var nums = readline().split(' ').map(Number);
        ans += (nums[2] - nums[0] + 1) * (nums[3] - nums[1] + 1);
    }
    print(ans);
}

function main(){
    var line  = readline();
    //var line = prompt();
    var n = line.length;
    //alert(line);
    var m = 0;
    for(i=0;i<n;i+=2){
        for(j=i+1;j<n;j+=2){
            var ex = [line.slice(0, i), '(', line.slice(i,j) , ')' , line.slice(j)].join('');
            m = Math.max(m,eval(ex));
        }
    }
    print(m);
}

// var n = parseInt(readline());
var input_line = readline().split(' ').map(Number);
var n =  input_line[0];
var m =  input_line[1];

var arr = readline().split(' ').map(Number);

while (arr[n-1] == 0) {
    arr.pop();
    n --;
}
/*
n = m = 100000;
for (i=0; i < n; i++) {
    arr[$i] = '10';
}
*/

var o_min = 0;
var o_max = 385000000;

var time = 0;
var arr_kor = [];
var posNotNull = 0;
var time_tmp = 0;

while (o_max - o_min > 1) {

    time = Math.round((o_min + o_max) / 2);

    arr_kor = arr.slice();
    posNotNull = 0;
    for (i=1; i <= m; i++) {

        time_tmp = time - posNotNull;
        for (j=posNotNull; j < n; j++) {
            time_tmp --;

            if (arr_kor[j] == 0) {
                posNotNull ++;
                continue;
            }

            if (arr_kor[j] < time_tmp) {
                time_tmp -= arr_kor[j];
                arr_kor[j] = 0;
            } else {
                arr_kor[j] -= time_tmp;
                break;
            }
        }
        if (arr_kor[n-1] == 0) break;
    }

    if (arr_kor[n-1] == 0) {
        o_max = time;
    } else {
        o_min = time;
    }

}

print(o_max);


var input = readline();
for(var i = 0; i < input; i ++) {
    var num = +readline();
    var c1 = c2 = Math.floor(num / 3);
    if(num % 3 > 0) num % 3 === 1 ? c1 ++ : c2 ++;
    print(c1 + ' ' + c2)
}

function jobs(n)
{
        c1 = Math.floor(n/3);
        if (n%3!=0) {checking = (((n/3)-c1)+'').split ('.') [1][0];}
        else {c2 = Math.round((n-c1)/2);return `${c1} ${c2}`;}
    if (checking>5)
    {

        c2 = Math.round((n-c1)/2);
    }
    else
    {
        c1++;
        c2 = Math.round((n-c1)/2);
    }
    return `${c1} ${c2}`;
//console.log(c1, c2);

    }
    t = parseInt(readline())
    for (i=0;i<t;i++){
        print(jobs(parseInt(readline())));

    }

function jobs()
{
    t = parseInt(readline())
    for (i=0;i<t;i++)
    {
        n = parseInt(readline())
        c1 = Math.floor(n/3);
        if (n%3!=0) {checking = (((n/3)-c1)+'').split ('.') [1][0];}
        else {c2 = Math.round((n-c1)/2);print(c1, c2);continue}

    if (checking>5)
    {

        c2 = Math.round((n-c1)/2);
    }
    else if (checking==0) {c2=Math.round((n-c1)/2)}
    else
    {
        c1++;
        c2 = Math.round((n-c1)/2);
    }

print(c1, c2);
    }

}

jobs()

var x = readline();
while (x--) {
  var n = readline();
  var b = Math.round(n / 3);
  var a = n - 2 * b;
  print(a + " " + b);
}

var t = readline();
while(t--)
{
    var n=readline();
    var c=Math.round(n/3);
    if(c*3==n)
    {
        print(c, c);
    }
    else if(n-3*c==1)
    {
        print(c+1, c);
    }
    else
    {
        print(c-1, c);
    }
}

var t = readline();
while(t--)
{
    var n=readline();
    var c=Math.round(n/3);
    var p=c+1;
    var z=c-1;
    if(c*3==n)
    {
        print(c+" "+c);
    }
    else if(n-3*c==1)
    {
        print(p+" "+c);
    }
    else
    {
        print(z+" "+c);
    }
}

s = readline(); while(s--){n = readline(); b = Math.round(n / 3); a = n - 2*b; print(a + " " + b);}

function polycarpAndCoins(coins) {
  var a1 = Math.floor(coins / 3);
  var a2 = coins % 3;
  if(a2 === 2) {
    return a1 + " " + (a1 + 1);
  }
  if(a2 === 1) {
    return (a1 + 1) + " " + a1;
  }
  return a1 + " " + a1;
}

const readNumber = () => +readline();

const n = readNumber();
for(var i = 0; i < n; i++) {
  print(polycarpAndCoins(readNumber()));
}

const readNumber = () => +readline();

const n = readNumber();

for(var i = 0; i < n; i++) {
  var v = readNumber();
  var a1 = Math.floor(v / 3);
  var a2 = v % 3;
  if(a2 === 2) {
    print(a1 + " " + (a1 + 1));
    continue;
  }
  if(a2 === 1) {
    print((a1 + 1) + " " + a1);
    continue;
  }
  print(a1 + " " + a1);
}

var cases = parseInt(readline());
    print();
    while(cases--){
        var target=parseInt(readline());
        var c2=parseInt(target/3);
        var c1=target-(c2*2);
        if(c1-c2==2){
            c1-=2;
            c2++;
        }
        print(c1+" "+c2);
    }

main(parseInt(readline()));
function main(cases) {
    print();
    while(cases--){
        var target=parseInt(readline());
        var c2=parseInt(target/3);
        var c1=target-(c2*2);
        if(c1-c2==2){
            c1-=2;
            c2++;
        }
        print(c1+" "+c2);
    }
}

function solve()
{
	var a = +readline();
	var z = Math.floor(a / 3);
	if(a % 3 === 0 )
	print(z + " "+ z);
	else if(a % 3 === 2 ) print ((z) + " "+ (z+1))
	else print((z+1) + " "+ (z))
}

	var  n = +readline();
	for (var i = 0; i < n; i++)
			solve();

var limit = parseInt(readline());
    for (var i = 0; i < limit; i++) {
        var value = parseInt(readline());
        var coins = Math.floor(value / 3);
        var ones = coins;
        var twos = coins;
        if (value % 3 !== 0) {
            if (value % 3 === 1)
                ones++;
            else
                twos++;
        }
        print("".concat(ones, " ").concat(twos));
    }

test = readline()
while (test--) {
    burles = readline();
    x = Math.round(burles / 3)
    y = burles - 2 * x;
    print(y,x)
}

var nm=readline()
while(nm--){
    var n=parseInt(readline())
    var t=parseInt(n/3)
    if(n%3!==2) print(n-(2*t)+ ' '+t)
    else{
        print(parseInt(n/3)+' '+(n-parseInt(n/3))/2)
    }
}

var t = Number(readline());

while (t--) {
    var buries = Number(readline());
    var b = buries / 3;

    if (buries % 3 == 0)
        print(b + " " + b);

    else {
        if (Math.floor(b) * 3 + 1 == buries)
            print(Math.floor(b) + 1 + " " + Math.floor(b));
        else
            print(Math.floor(b) + " " + (Math.floor(b) + 1));
    }
}

var numberOfCases = Number(readline());
for (var i = 0; i < numberOfCases; ++i) {
    processCase();
}

function processCase() {
    var n = Number(readline());

    var c1 = c2 = Math.floor(n / 3);
    if (n % 3 === 1) {
        ++c1;
    }

    if (n % 3 === 2) {
        ++c2;
    }

    print(`${c1} ${c2}`);
}

var testCases = +readline();

while (testCases-- > 0) {
    var n = +readline();

    var n3 = Math.floor(n / 3);
    switch (n % 3) {
        case 0:
            print(n3, n3);
            break;
        case 1:
            print(n3 + 1, n3);
            break;
        case 2:
            print(n3, n3 + 1)
            break;
    }
}

var l0 = readline();
var n = +l0;
var arr = [];
for (var a = 0; a<n; a++) {
    arr.push(+readline());
}

// 1 burles
// 2 burles
var one = 0;
var two = 0;
var sum = 0;
for (var x = 0; x<arr.length; x++) {
    var temp = Math.floor(arr[x]/3);
    var one = temp;
    var two = temp;
    if (arr[x]%3===2) two++;
    if (arr[x]%3===1) one++;
    print(one, two);
}

"use strict";

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let _inputString = '';
let _currentLine = 0;

process.stdin.on('data', inputStdin => {
    _inputString += inputStdin;
});

process.stdin.on('end', _ => {
    _inputString = _inputString.trim().split('\n').map(string => string.trim());
    main();
});

const readLine = () => _inputString[_currentLine++];

const nextIntArray = () => readLine.split(" ").map(x => parseInt(x));
const nextFloatArray = () => readLine.split(" ").map(x => parseFloat(x));
const nextInt = () => parseInt(readLine());

const gcd = (a, b) => a ? gcd(b % a, a) : b;
const lcm = (a, b) => a * b / gcd(a, b);

function print(...args) {
    console.log(...args);
}

function solve() {
    let n = nextInt();
    let a = Math.floor(n / 3);
    let m = n % 3;
    let b = a;
    a += m;
    let c = a - 2;
    let d = b + 1;
    if (Math.abs(a - b) <= Math.abs(c - d)) {
        print(a, b);
    } else {
        print(c, d);
    }
}

function main() {
    let testCases = 1;
    testCases = parseInt(readLine());
    for (let i = 0; i < testCases; i++) {
        solve();
    }
}

process.stdin.resume();

process.stdin.setEncoding("utf8");

let input = "";

process.stdin.on("data", (data) => {
  input += data;
});
process.stdin.on("end", () => {
  main(input);
});

function main(input) {
  input = input.split("\n");
  let z = 0;
  let testCases = parseInt(input[z++], 10);

  while (testCases--) {
    let str = input[z++].trim();
    solve(str);
  }
}

function solve(str) {
  const sum = parseInt(str, 10);
  let countOne = Math.floor(sum / 3);
  let countTwo = countOne;

  const left = sum % 3;

  if (left === 1) {
    countOne++;
  }

  if (left === 2) {
    countTwo++;
  }

  console.log(`${countOne} ${countTwo}`);
}

const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let c = 0;

const calc = (a, b) => {
  return a + 2 * b;
};

rl.on("line", (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const n = Number(d);
  const mid = Math.floor(n / 3);
  let c1 = mid;
  let c2 = mid;

  if (n % 3 === 1) {
    c1++;
  }

  if (n % 3 === 2) {
    c2++;
  }

  console.log(c1, c2);

  // const mid = Number(d) / 3;
  // const min = Math.floor(mid);
  // const max = Math.ceil(mid);

  // if (calc(min, max) === Number(d)) {
  //   console.log(min, max);
  // } else {
  //   console.log(max, min);
  // }
  c++;
});

rl.on("close", () => {});

const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let c = 0;

const calc = (a, b) => {
  return a + 2 * b;
};

rl.on("line", (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const mid = Number(d) / 3;
  const min = Math.floor(mid);
  const max = Math.ceil(mid);

  if (calc(min, max) === Number(d)) {
    console.log(min, max);
  } else {
    console.log(max, min);
  }
  c++;
});

rl.on("close", () => {});

// Common Template Starts //
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = ""
let currentLine = 0

process.stdin.on("data", inputStdin => inputString += inputStdin)

process.stdin.on("end", (_) => {
    inputString = inputString.trim().split("\n").map((string) => string.trim())
    main()
})

const readline = () => inputString[currentLine++]
// Common Template Ends //

// Driver Function Starts //
const main = () => {
    console.clear()
    let t = parseInt(readline())
    while (t--) {
        let n = parseInt(readline())
        // let a = readline().split(' ').map(Number)
        console.log(solve(n))
    }
}
// Driver Function Ends //

// MAIN LOGIC
const solve = (n) => {
    if ( n == 1 ) return '1 0'
    if ( n == 2 ) return '0 1'
    if ( n == 3 ) return '1 1'
    if ( n == 4 ) return '2 1'
    if ( n == 5 ) return '1 2'

    let twos1 = Math.floor( n / 3 )
    let ones1 = n - (twos1 * 2)
    let diff1 = Math.abs( ones1 - twos1 )

    let twos2 = Math.ceil( n / 3 )
    let ones2 = n - (twos2 * 2)
    let diff2 = Math.abs( ones2 - twos2 )

    return ( diff1 < diff2 ) ? ones1 + ' ' + twos1 : ones2 + ' ' + twos2
}

const isOdd = (x) => { return x & 1 }
const isEven = (x) => { return !(x & 1) }
const minOfArray   = (arr) => Math.min.apply(null, arr)
const maxOfArray   = (arr) => Math.max.apply(null, arr)
const uniqueArray  = (arr) => [...new Set(arr)]
const sortArray    = (arr) => arr.sort((a, b) => a - b)
const sumOfArray   = (arr) => arr.reduce((partialSum, a) => partialSum + a, 0)

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
        var k = lines[j];
        var a = Math.floor(k / 3);
        var b = Math.floor(k / 3);
         if(k % 3 == 1){
            a++;
        }else if(k % 3 == 2){
            b++;
        }
        console.log(a + ' ' + b);
    }
});

'use strict';

// let env_local = true;
let env_local = false;
let inputString = '';
let currentLine = 0;

if (!env_local) {
  process.stdin.resume();
  process.stdin.setEncoding('utf-8');

  process.stdin.on('data', (inputStdin) => {
    inputString += inputStdin;
  });

  process.stdin.on('end', (_) => {
    inputString = inputString
      .trim()
      .split('\n')
      .map((string) => {
        return string.trim();
      });

    main();
  });
} else {
  const fs = require('fs');
  inputString = fs
    .readFileSync(__dirname + '/input.txt', 'utf-8')
    .split('\n')
    .map((string) => {
      return string.trim();
    });
  main();
}

function readline() {
  return inputString[currentLine++];
}

/*--------------------------------Play-ground---------------------------------------*/

var maxN = 2 * 1e5 + 10;

var mod = BigInt(1e9 + 7);

function solve() {
  let n = parseInt(readline());
  let c1 = 0,
    c2 = 0;
  let y = parseInt(n / 3);
  c1 += y;
  c2 += y;
  let x = n % 3;

  if (x == 2) c2++;
  else if (x == 1) c1++;
  console.log(`${c1} ${c2}`);
}

function main() {
  let t = parseInt(readline()) || 1;
  while (t--) {
    solve();
  }
}

// var n = Number(readline());

// for (var i = 1; i <= n; i++) {
//     var m = Number(readline());
//     var a = parseInt(Math.round(m / 3));
//     var b = parseInt(Math.round(m - (a * 2)));
//     console.log(b + " " + a);
// }

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
    console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});
process.stdin.on("end", () => {
    inputString = inputString.split("\n");
    main();
});

function readline() {
    return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

    var n = Number(readline());

    for (var i = 1; i <= n; i++) {
        var m = Number(readline());
        var a = parseInt(Math.round(m / 3));
        var b = parseInt(Math.round(m - (a * 2)));
        console.log(b + " " + a);
    }

}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 07/23/21 morning
 * https://codeforces.com/contest/1551/problem/A
 */
const solve = (x) => {
    let a = int(x / 3);
    let b = ce (x / 3);
    if (a + 2 * b != x) return pr(b, a);
    pr(a, b)
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(Number(line));
    });
    rl.on('close', () => {
        let t = input[0];
        let i = 1;
        while (t--) {
            solve(input[i]);
            i++;
        }
    });
};

main()

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        solve();
    }
}

function solve() {
    let input = readLine();
    // console.log("inputNo", inputNo);

    var c1 = Math.floor(input / 3);
    var c2 = c1;
    var rem = input % 3;

    // console.log("rem",rem)

    if (rem == 2) {
        c2++;
    }
    else if (rem == 1) {
        c1++;
    }
    console.log(c1 + " " + c2)

}

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0; i < t; i++){
		let x = nl.num();
		let c = Math.trunc(x / 3);
		ans.push([c + (x%3 == 1?1:0), c + (x%3 == 2?1:0)]);
	}
	console.log(ans.map(e => e.join(' ')).join('\n'));
};

process.stdin.on('end', sol);

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var j = 1; j <= n; j++){
        var k = lines[j];
        var a = Math.floor(k / 3);
        var b = Math.floor(k / 3);
        if(k % 3 == 1){
            a++;
        }else if(k % 3 == 2){
            b++;
        }
        console.log(a + ' ' + b);
    }
});

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const n = rna();

		let c1 = Math.floor(n/3);
		let c2 = c1;

		c1 += n%3 == 1;
		c2 += n%3 == 2;

		console.log(c1, c2);
	}
}

/**
 * Bismillahir Rahmanir Rahim
 * This code has been taken from: https://codeforces.com/blog/entry/69610
 */
 process.stdin.resume();
 process.stdin.setEncoding('utf-8');

 let inputString = '';
 let currentLine = 0;

 process.stdin.on('data', inputStdin => {
     inputString += inputStdin;
 });

 process.stdin.on('end', _ => {
     inputString = inputString.trim().split('\n').map(string => {
         return string.trim();
     });

     main();
 });

 function readLine() {
     return inputString[currentLine++];
 }

 /****** BELOW HERE START WRITING YOUR CODE IN main() FUNCTION   ***************************************/
 /**
  * Use "readLine()" function for input, which will return a string consisting the entire line, so accordingly split the string
  * when required.
  *
  * I am using console.log() to output
  */
//  function main() {
//      let t = readLine();
//      t = parseInt(t);
//      console.log("mai yahan aaya")
//      while(t--) {
//          let line = readLine();
//          line = line.split(" ");
//          let n = parseInt(line[0]);
//          let m = parseInt(line[1]);
//          if(n === 1) {
//              console.log("0");
//          } else if (n === 2) {
//              console.log(m);
//          } else {
//              console.log(2*m);
//          }
//      }
//  }

function main() {

	let t = parseInt(readLine());
	// t = parseInt(t);
	while(t--) {
		let n = readLine();
		n = parseInt(n);
		//let s = readLine().split(" ").map(item=>parseInt(item));
		solve(n);

	}
    // console.log(t);
}

function solve(n) {
	let c = parseInt(n / 3) ;
	if (n % 3 == 0) {
		console.log(c, c);
	} else if (n % 3 == 1) {
		console.log(c+1, c);
	} else {
		console.log(c, c+1);
	}
}

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let input = '';
process.stdin.on('data', inputStdin => {
    input += inputStdin;
});
process.stdin.on('end', _ => {
    main(input);
});
// Make a Snippet for the code above this and then write your logic in main();

function main(input) {
    const args = input.split('\n');
    const t = parseInt(args[0], 10)
    for (var i = 1; i <= t; i++) {
        const c = parseInt(args[i], 10);
        const c3 = Math.floor(c / 3);
        if (c % 3 === 0) {
            console.log(c3, c3);
        } else if (c % 3 === 1) {
            console.log(c3 + 1, c3);
        } else {
            console.log(c3, c3 + 1);
        }
    }
}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let number = +input[z++];
        let count1 = Math.floor(number / 3)
        let count2 = count1;

        if(number % 3 === 1) count1++;
        else if(number % 3 === 2) count2++;
        console.log(count1, count2);
    }
}

const fs = require('fs');

const input = String(fs.readFileSync(0))
  .split('\n')
  .filter(Boolean)
  .map((str) => str.trim());

for (let i = 1; i < input.length; i += 1) {
  const n = input[i];
  console.log(solve(parseInt(n)));
}

function solve(n) {
  let c1 = Math.floor(n / 3);
  let c2 = Math.floor(n / 3);

  while (c1 + 2 * c2 <= n) {
    if (c1 + 2 * c2 === n) {
      return `${c1} ${c2}`;
    }

    if (c1 + 1 + 2 * c2 === n) {
      return `${c1 + 1} ${c2}`;
    }

    if (c1 + 2 * (c2 + 1) === n) {
      return `${c1} ${c2 + 1}`;
    }

    c1 += 1;
    c2 += 1;
  }

  return 'error after';
}

let i = ''
let lines;
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    lines = i.split('\n'); // your input text, split by lines
    main();
});

function main() {
    let t = parseInt(lines.shift());

    while (t > 0) {
        const n = parseInt(lines.shift());
        let c1 = Math.floor(n / 3);
        let c2 = Math.floor(n / 3);
        switch (n % 3) {
            case 1:
                c1++;
                break;
            case 2:
                c2++;
                break;
        }
        console.log(c1, c2);
        t--;
    }
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0;
    var t = +lines[l++]
    for (var i = 0; i < t; i++) {
        var a = +lines[l++]
        console.log(solve(a))
    }
});

function solve(n) {
    const k = Math.floor(n / 3)
    const r = n % 3
    let a = k
    let b = k
    if (r === 1) {
        a++
    } else if (r === 2) {
        b++
    }
    return [a, b].join(' ')
}

function polycarp(input) {
    var c1 = Math.floor(input / 3);
    var c2 = c1;
    var rem = input % 3;
    if (rem == 2) c2++;
    else if (rem == 1) c1++;
    return `${c1} ${c2}`;
}

var n = parseInt(readline());
for (var i = 0; i < n; i++) {
    var input = readline();
    print(polycarp(input));
}

function polycarp(input) {
    var c1 = Math.floor(input / 3);
    var c2 = c1;
    var rem = input % 3;
    if (rem == 2) c2++;
    else if (rem == 1) c1++;
    return `${c1} ${c2}`;
}

var n = parseInt(readline());
for (var i = 0; i < n; i++) {
    var input = +readline();
    print(polycarp(input));
}

function polycarp(input) {
    var c1 = Math.floor(input / 3);
    var c2 = c1;
    var rem = input % 3;
    if (rem == 2) c2++;
    else if (rem == 1) c1++;
    return c1 + ' ' + c2; // `${c1} ${c2}`;
}

var n = parseInt(readline());
for (var i = 0; i < n; i++) {
    var input = +readline();
    print(polycarp(input));
}

// var input = readline();
// for(var i = 0; i < input; i ++) {
//     var num = +readline();
//     var c1 = c2 = Math.floor(num / 3);
//     if(num % 3 > 0) num % 3 === 1 ? c1 ++ : c2 ++;
//     print(c1 + ' ' + c2)
// }

var input = readline();
for(var i = 0; i < input; i ++) {
    var num = +readline();
    var c1 = c2 = Math.floor(num / 3);
    if(num % 3 > 0) num % 3 === 1 ? c1 ++ : c2 ++;
    print(`${c1} ${c2}`)
}

var input = readline();
for(var i = 0; i < input; i ++) {
    var num = parseInt(readline());
    var c1 = c2 = Math.floor(num / 3);
    if(num % 3 > 0) num % 3 === 1 ? c1 ++ : c2 ++;
    print(c1 + ' ' + c2)
}

var input = readline();
for(var i = 0; i < input; i ++) {
    var num = readline();
    var c1 = c2 = Math.floor(num / 3);
    if(num % 3 > 0) num % 3 === 1 ? c1 ++ : c2 ++;
    print(c1 + ' ' + c2)
}

"use strict";

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let _inputString = '';
let _currentLine = 0;

process.stdin.on('data', inputStdin => {
    _inputString += inputStdin;
});

process.stdin.on('end', _ => {
    _inputString = _inputString.trim().split('\n').map(string => string.trim());
    main();
});

const readLine = () => _inputString[_currentLine++];

const nextIntArray = () => readLine.split(" ").map(x => parseInt(x));
const nextFloatArray = () => readLine.split(" ").map(x => parseFloat(x));
const nextInt = () => parseInt(readLine());

const gcd = (a, b) => a ? gcd(b % a, a) : b;
const lcm = (a, b) => a * b / gcd(a, b);

function print(...args) {
    console.log(...args);
}

function solve() {
    let n = nextInt();
    let a = Math.floor(n / 3);
    let m = n % 3;
    let b = a + m;
    let c = a + 2;
    let d = b - 1;
    if (Math.abs(a - b) <= Math.abs(c - d)) {
        print(a, b);
    } else {
        print(c, d);
    }
}

function main() {
    let testCases = 1;
    testCases = parseInt(readLine());
    for (let i = 0; i < testCases; i++) {
        solve();
    }
}

"use strict";

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let _inputString = '';
let _currentLine = 0;

process.stdin.on('data', inputStdin => {
    _inputString += inputStdin;
});

process.stdin.on('end', _ => {
    _inputString = _inputString.trim().split('\n').map(string => string.trim());
    main();
});

const readLine = () => _inputString[_currentLine++];

const nextIntArray = () => readLine.split(" ").map(x => parseInt(x));
const nextFloatArray = () => readLine.split(" ").map(x => parseFloat(x));
const nextInt = () => parseInt(readLine());

const gcd = (a, b) => a ? gcd(b % a, a) : b;
const lcm = (a, b) => a * b / gcd(a, b);

function print(...args) {
    console.log(...args);
}

function solve() {
    let n = nextInt();
    let a = n / 3;
    let m = n % 3;
    let b = a + m;
    let c = a + 2;
    let d = b - 1;
    if (Math.abs(a - b) <= Math.abs(c - d)) {
        print(a, b);
    } else {
        print(c, d);
    }
}

function main() {
    let testCases = 1;
    testCases = parseInt(readLine());
    for (let i = 0; i < testCases; i++) {
        solve();
    }
}

"use strict";

const fs = require("fs");

const _access = fs.createReadStream("input.txt");
process.stdin.read = _access.read.bind(_access);

let local = true;
process.on("uncaughtException", err => {
    local = false;
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let _inputString = '';
let _currentLine = 0;

process.stdin.on('data', inputStdin => {
    _inputString += inputStdin;
});

process.stdin.on('end', _ => {
    _inputString = _inputString.trim().split('\n').map(string => string.trim());
    main();
});

const readLine = () => _inputString[_currentLine++];

const nextIntArray = () => readLine.split(" ").map(x => parseInt(x));
const nextFloatArray = () => readLine.split(" ").map(x => parseFloat(x));
const nextInt = () => parseInt(readLine());

const gcd = (a, b) => a ? gcd(b % a, a) : b;
const lcm = (a, b) => a * b / gcd(a, b);

function print(...args) {
    console.log(...args);
}

function solve() {
    let n = nextInt();
    let a = n / 3;
    let m = n % 3;
    let b = a + m;
    let c = a + 2;
    let d = b - 1;
    if (Math.abs(a - b) <= Math.abs(c - d)) {
        print(a, b);
    } else {
        print(c, d);
    }
}

function main() {
    let testCases = 1;
    testCases = parseInt(readLine());
    for (let i = 0; i < testCases; i++) {
        solve();
    }
}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = parseInt(input[z++], 10);

    while(testCases--){
        let str = input[z++].trim().split('');
        solve(str)
    }
}

function solve(str){
  const sum = parseInt(str, 10);
  let count = Math.floor(sum / 3);

  const left = sum % 3

  if(left === 0){
    console.log(`${count} ${count}`);
  } else if(left === 1){
    console.log(`${count++} ${count}`);
  } else {
    console.log(`${count} ${count++}`);
  }

}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = Number(input[z++]);

    while(testCases--){
        let str = input[z++].trim().split('');
        solve(str)
    }
}

function solve(str){
  const sum = Number(str);
  let count = Math.floor(sum);

  const left = sum % 3

  if(left === 0){
    console.log(`${count} ${count}`);
  } else if(left === 1){
    console.log(`${count++} ${count}`);
  } else {
    console.log(`${count} ${count++}`);
  }

}

// Common Template Starts //
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = ""
let currentLine = 0

process.stdin.on("data", inputStdin => inputString += inputStdin)

process.stdin.on("end", (_) => {
    inputString = inputString.trim().split("\n").map((string) => string.trim())
    main()
})

const readline = () => inputString[currentLine++]
// Common Template Ends //

// Driver Function Starts //
const main = () => {
    console.clear()
    let t = parseInt(readline())
    while (t--) {
        let n = parseInt(readline())
        // let a = readline().split(' ').map(Number)
        console.log(solve(n))
    }
}
// Driver Function Ends //

// MAIN LOGIC
const solve = (n) => {
    if ( n == 1 ) return '1 0'
    if ( n == 2 ) return '0 1'
    if ( n == 3 ) return '1 1'
    if ( n == 4 ) return '2 1'
    if ( n == 5 ) return '1 2'

    let twos1 = Math.floor( n / 3 )
    let ones1 = n - (twos1 * 2)
    let diff1 = Math.abs( ones1 - twos1 )

    let twos2 = Math.ceil( n / 3 )
    let ones2 = n - (twos2 * 2)
    let diff2 = Math.abs( ones2 - twos2 )

    return ( diff1 < diff2 ) ? twos1 + ' ' + ones1 : twos2 + ' ' + ones2
}

const isOdd = (x) => { return x & 1 }
const isEven = (x) => { return !(x & 1) }
const minOfArray   = (arr) => Math.min.apply(null, arr)
const maxOfArray   = (arr) => Math.max.apply(null, arr)
const uniqueArray  = (arr) => [...new Set(arr)]
const sortArray    = (arr) => arr.sort((a, b) => a - b)
const sumOfArray   = (arr) => arr.reduce((partialSum, a) => partialSum + a, 0)

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(j = 1; j <= n; j++){
        var k = lines[j];
        var a = Math.floor(k / 3);
        var b = Math.floor(k / 3);
        console.log(a + ' ' + b);
    }
});

'use strict';

// let env_local = true;
let env_local = false;
let inputString = '';
let currentLine = 0;

if (!env_local) {
  process.stdin.resume();
  process.stdin.setEncoding('utf-8');

  process.stdin.on('data', (inputStdin) => {
    inputString += inputStdin;
  });

  process.stdin.on('end', (_) => {
    inputString = inputString
      .trim()
      .split('\n')
      .map((string) => {
        return string.trim();
      });

    main();
  });
} else {
  const fs = require('fs');
  inputString = fs
    .readFileSync(__dirname + '/input.txt', 'utf-8')
    .split('\n')
    .map((string) => {
      return string.trim();
    });
  main();
}

function readline() {
  return inputString[currentLine++];
}

/*--------------------------------Play-ground---------------------------------------*/

var maxN = 2 * 1e5 + 10;

var mod = BigInt(1e9 + 7);

function solve() {
  let n = parseInt(readline());
  let c1 = 0,
    c2 = 0;
  let y = parseInt(n / 3);
  c1 += y;
  c2 += y;
  let x = n % 3;

  if (x == 2) c2++;
  else c1++;
  console.log(`${c1} ${c2}`);
}

function main() {
  let t = parseInt(readline()) || 1;
  while (t--) {
    solve();
  }
}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 07/23/21 morning
 * https://codeforces.com/contest/1551/problem/A
 */
const solve = (x) => {
    pr(ce(x / 3), int(x / 3))
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(Number(line));
    });
    rl.on('close', () => {
        let t = input[0];
        let i = 1;
        while (t--) {
            solve(input[i]);
            i++;
        }
    });
};

main()

var t = readline();
while (t--) {
  var x = readline();
  var z = Math.round(x / 3);
  if (z + ((x - x / 3) / 2) * 2 !== x) {
    z += 1;
  }

  print(z + " " + Math.round((x - x / 3) / 2));
}

var t = readline();
while (t--) {
  var x = readline();
  var z = Math.round(x / 3);
  if (z + ((x - x / 3) / 2) * 2 !== x) {
    z += 1;
  }

  print(z + " " + Number((x - x / 3) / 2));
}

var t = readline();
while (t--) {
  var x = readline();
  var z = Math.round(x / 3);
  if (z + ((x - x / 3) / 2) * 2 !== x) {
    z += 1;
  }

  print(z + " " + (x - x / 3) / 2);
}

var t = readline();
while(t--)
{
    var n=readline();
    var c=Math.round(n/3);
    var p=c+1;
    var z=c-1;
    if(c*3===n)
    {
        print(c+" "+c);
    }
    else if(n-3*c==1)
    {
        print(p+" "+c);
    }
    else
    {
        print(z+" "+c);
    }
}

function solve()
{
	var a = +readline();
	var z = Math.floor(a / 3);
	if(a % 3 === 0 )
	print(z + " "+ z);
	else print ((z+1) + " "+ z)
}

	var  n = +readline();
	for (var i = 0; i < n; i++)
			solve();