interface Endl {
  abstract void endl(myInteger i);
}

class myInteger {
  private int n;
  private boolean flag;
  private myInteger fizzbuzzgizz(int m, String mes, Endl endl) {
    if (this.n % m == 0) {
      this.flag = false;
      System.out.print(mes);
    }
    if (endl != null) endl.endl(this);
    return this;
  }
  public myInteger(int n) { this.n = n; flag = true; }
  public myInteger fizz() { return this.fizzbuzzgizz(3, "Fizz", null); }
  public myInteger buzz() { return this.fizzbuzzgizz(5, "Buzz", null); }
  public myInteger gizz() { return this.fizzbuzzgizz(7, "Gizz", new Endl() {
                                                                  public void endl(myInteger i) {
                                                                    if (i.flag == true)
                                                                      System.out.println(i.n);
                                                                    else
                                                                      System.out.println();
                                                                    } }); }
}

class Main {
  public static void main(String[] args) {
    new myInteger(1).fizz().buzz().gizz();
    new myInteger(3).fizz().buzz().gizz();
    new myInteger(5).fizz().buzz().gizz();
    new myInteger(7).fizz().buzz().gizz();
    new myInteger(15).fizz().buzz().gizz();
    new myInteger(21).fizz().buzz().gizz();
    new myInteger(35).fizz().buzz().gizz();
    new myInteger(105).fizz().buzz().gizz();
    new myInteger(997).fizz().buzz().gizz();
  }
}
/* end */
