
#include <iostream>
#include <fstream>
#include <string>

int main()
{
	try {
		std::ifstream fs("ファイル名.txt");
		if (!fs)
			throw std::exception();
			
		std::string line;
		std::getline(fs, line);
		if (line.empty())
			throw std::exception();
			
		std::ifstream fs2(line);
		if (!fs2)
			throw std::exception();
			
		std::getline(fs2, line);
		std::cout << line << std::endl;
		
	} catch (std::exception& e) {
		return -1;
	}
	return 0;
}