// Arup Guha
// 1/16/2017
// Solution to 2014 NAQ Problem A: Eight Queens

import java.util.*;

public class eightqueens {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		ArrayList<int[]> list = new ArrayList<int[]>();
		boolean res = true;
		int total = 0;

		// Read in each line.
		for (int i=0; i<8; i++) {
			char[] line = stdin.next().toCharArray();

			// Add in queens on this row.
			int cnt = 0;
			for (int j=0; j<8; j++) {
				if (line[j] == '*') {
					list.add(new int[] {i,j});
					cnt++;
				}
			}

			// Add these in.
			total += cnt;

			// Impossible.
			if (cnt > 1) {
				res = false;
				break;
			}
		}

		// Output result checking actual coordinates if necessary.
		if (total == 8 && res && check(list))
			System.out.println("valid");
		else
			System.out.println("invalid");
	}

	public static boolean check(ArrayList<int[]> list) {

		// Go through all pairs.
		for (int i=0; i<list.size(); i++) {
			for (int j=i+1; j<list.size(); j++) {

				// For ease of access.
				int[] a = list.get(i);
				int[] b = list.get(j);

				// Same row or column.
				if (a[0] == b[0] || a[1] == b[1]) return false;

				// On same diagonal.
				if (Math.abs(a[0]-b[0]) == Math.abs(a[1]-b[1])) return false;
			}
		}

		// If we get here, we're good.
		return true;
	}
}