
class        lowercase	:  # Public class to implement a graph




							def __init__(       self     ,A__     ,A__     ,A__):
												lowercase					=		row
												lowercase					=		col
												lowercase					=		graph




							def 				A__   (       self     ,A__     ,A__     ,A__):
												return (
												    0 <= i < self.ROW
												    and 0 <= j < self.COL
												    and not visited[i][j]
												    and self.graph[i][j]
												)




							def 				A__   (       self     ,A__     ,A__     ,A__):
												# Checking all 8 elements surrounding nth element
												lowercase					=		[-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
												lowercase					=		[-1, 0, 1, -1, 1, -1, 0, 1]
												lowercase					=		True  # Make those cells visited
												for k in range(8):
																	if self.is_safe(i + row_nbr[k]     ,j + col_nbr[k]     ,A__):
																						self.diffs(i + row_nbr[k]     ,j + col_nbr[k]     ,A__)





							def 				A__   (       self):  # And finally, count all islands.
												lowercase					=		[[False for j in range(self.COL)] for i in range(self.ROW)]
												lowercase					=		0
												for i in range(self.ROW):
																	for j in range(self.COL):
																						if visited[i][j] is False and self.graph[i][j] == 1:
																											self.diffs(A__     ,A__     ,A__)
																											count += 1
												return count






def  UpperCamelCase					(							lowerCAmelCase__				,    lowerCAmelCase__	):
					'''simple docstring'''
					return int((input_a, input_a).count(0	) == 0	)



def  UpperCamelCase					(							):
					'''simple docstring'''
					assert and_gate(0				,    0	) == 0
					assert and_gate(0				,    1	) == 0
					assert and_gate(1				,    0	) == 0
					assert and_gate(1				,    1	) == 1


if __name__ == "__main__":
							test_and_gate()
							print(and_gate(1, 0))
							print(and_gate(0, 0))
							print(and_gate(0, 1))
							print(and_gate(1, 1))




