interface Connectable {
    void connectToInternet();
}

abstract class Device {
    protected String model;

    public Device(String model) {
        this.model = model;
    }

    public abstract void turnOn();
}

class Phone extends Device implements Connectable {
    public Phone(String model) {
        super(model);
    }

    @Override
    public void turnOn() {
        System.out.println("Phone " + model + ": Phone brand logo");
    }

    @Override
    public void connectToInternet() {
        System.out.println("Phone " + model + ": Connecting to 5G network.");
    }
}

class Laptop extends Device implements Connectable {
    public Laptop(String model) {
        super(model);
    }

    @Override
    public void turnOn() {
        System.out.println("Laptop " + model + ": Beeper signal... UEFI boot screen... OS boot screen");
    }
    @Override
    public void connectToInternet() {
        System.out.println("Laptop " + model + ": Connecting to Wi-Fi network.");
    }
}

class Tablet extends Device {
    public Tablet(String model) {
        super(model);
    }

    @Override
    public void turnOn() {
        System.out.println("Tablet " + model + ": Tablet brand logo");
    }
}

public class Main {
    public static void main(String[] args) {
        Device[] devices = {
                new Phone("Pixel 10"),
                new Laptop("HP EliteBook 845"),
                new Tablet("Galaxy Tab 24")
        };

        for (Device d : devices) {
            d.turnOn();

            if (d instanceof Connectable) {
                ((Connectable) d).connectToInternet();
            } else {
                System.out.println(d.model + ": cannot connect to the internet.");
            }
        }
    }
}