Only democracy can function in Pakistan: CJP