class Osoba
	attr_accessor :ime, :prezime
	
	def initialize ime, prezime
		self.ime = ime
		self.prezime = prezime
	end
	
	def <=> other
		rez = self.prezime <=> other.prezime
		return self.ime <=> other.ime if rez == 0
		return rez
	end
	
	def to_s
		"#{ime} #{prezime}"
	end
end

nesortiran_niz_osoba = [
	Osoba.new('Pera', 'Peric'),
	Osoba.new('Bora', 'Peric'),
	Osoba.new('Bora', 'Boric'),
]

nesortiran_niz_osoba.sort.each do |osoba|
	puts osoba
end
	