
from __future__ import annotations

from typing import Any


class       _lowerCAmelCase   :







							'''simple docstring'''

							def __init__(self  ,  UpperCAmelCase = 6  )					->       None:
														_snake_case       =  None
														_snake_case       =  None
														self.create_linked_list(UpperCAmelCase  )

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
														_snake_case       =  Node()
														_snake_case       =  current_node
														_snake_case       =  current_node
														_snake_case       =  current_node
														for _ in range(1  ,  UpperCAmelCase  ):
																					_snake_case       =  Node()
																					_snake_case       =  current_node
																					_snake_case       =  previous_node
																					_snake_case       =  current_node
														_snake_case       =  self.front
														_snake_case       =  previous_node

							def 	lowercase							(self  )					->       bool:
														return (
														    self.front == self.rear
														    and self.front is not None
														    and self.front.data is None
														)

							def 	lowercase							(self  )					->       Any | None:
														self.check_can_perform_operation()
														return self.front.data if self.front else None

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
														if self.rear is None:
																					return

														self.check_is_full()
														if not self.is_empty():
																					_snake_case       =  self.rear.next
														if self.rear:
																					_snake_case       =  data

							def 	lowercase							(self  )					->       Any:
														self.check_can_perform_operation()
														if self.rear is None or self.front is None:
																					return None
														if self.front == self.rear:
																					_snake_case       =  self.front.data
																					_snake_case       =  None
																					return data

														_snake_case       =  self.front
														_snake_case       =  old_front.next
														_snake_case       =  old_front.data
														_snake_case       =  None
														return data

							def 	lowercase							(self  )					->       None:
														if self.is_empty():
																					raise Exception("""Empty Queue"""  )





							def 	lowercase							(self  )					->       None:
														if self.rear and self.rear.next == self.front:
																					raise Exception("""Full Queue"""  )


class       _lowerCAmelCase   :







							'''simple docstring'''

							def __init__(self  )					->       None:
														_snake_case       =  None
														_snake_case       =  None
														_snake_case       =  None


if __name__ == "__main__":
				import doctest

				doctest.testmod()

'''simple docstring'''
def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):

							if not (isinstance(_SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				) and isinstance(_SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				)):
														raise ValueError("""longest_common_substring() takes two strings for inputs"""				)

							_snake_case       =  len(_SCREAMING_SNAKE_CASE				)
							_snake_case       =  len(_SCREAMING_SNAKE_CASE				)

							_snake_case       =  [[0] * (texta_length + 1) for _ in range(texta_length + 1				)]
							_snake_case       =  0
							_snake_case       =  0

							for i in range(1							, texta_length + 1				):
														for j in range(1							, texta_length + 1				):
																					if texta[i - 1] == texta[j - 1]:
																												_snake_case       =  1 + dp[i - 1][j - 1]
																												if dp[i][j] > ans_length:
																																			_snake_case       =  i
																																			_snake_case       =  dp[i][j]

							return texta[ans_index - ans_length : ans_index]


if __name__ == "__main__":
				import doctest

				doctest.testmod()