// $Id: objinst.csharp,v 1.0 2002/02/14 13:27:00 dada Exp $
// http://dada.perl.it/shootout/

using System;

class Toggle {
    public bool state = true;
    public Toggle(bool start_state) {
        this.state = start_state;
    }
    
    public bool value() {
        return(this.state);
    }
    
    public Toggle activate() {
        this.state = !this.state;
        return(this);
    }
}

class NthToggle : Toggle {
    int count_max = 0;
    int counter = 0;

    public NthToggle(bool start_state, int max_counter) : base(start_state) {
        this.count_max = max_counter;
        this.counter = 0;
    }
    public new NthToggle activate() {
        this.counter += 1;
        if (this.counter >= this.count_max) {
            this.state = !this.state;
            this.counter = 0;
        }
        return(this);
    }
}

class App {
    public static int Main(String[] args) {
        int n;

        n = System.Convert.ToInt32(args[0]);
        if(n < 1) n = 1;

        Toggle toggle1 = new Toggle(true);
        for (int i=0; i<5; i++) {
            Console.WriteLine((toggle1.activate().value()) ? "true" : "false");
        }

        for (int i=0; i<n; i++) {
            Toggle toggle = new Toggle(true);
        }
        Console.WriteLine();
        
        
        NthToggle ntoggle1 = new NthToggle(true, 3);
        for (int i=0; i<8; i++) {
            Console.WriteLine((ntoggle1.activate().value()) ? "true" : "false");
        }
        for (int i=0; i<n; i++) {
            NthToggle toggle = new NthToggle(true, 3);
        }
        return(0);
    }
}