Main part of third task