#include <algorithm>
#include <iostream>
using namespace std;

int main() {
	const auto foo = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
	auto bar = cbegin(foo);

	for (auto it = bar + 3; it < cend(foo); bar = it, it = bar + 3) {
		for_each(bar, it, [](const auto& i) { cout << i << endl; });
	}

	for_each(bar, cend(foo), [](const auto& i) { cout << i << endl; });
}