Implement IDDFS.