




"""simple docstring"""
from __future__ import annotations

import unittest

from transformers import AlbertConfig, is_tf_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
			import tensorflow as tf

			from transformers import TF_MODEL_FOR_PRETRAINING_MAPPING
			from transformers.models.albert.modeling_tf_albert import (
			    TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
			    TFAlbertForMaskedLM,
			    TFAlbertForMultipleChoice,
			    TFAlbertForPreTraining,
			    TFAlbertForQuestionAnswering,
			    TFAlbertForSequenceClassification,
			    TFAlbertForTokenClassification,
			    TFAlbertModel,
			)
class      lowerCAmelCase_						:



							'''simple docstring'''





							def __init__(				self  ,							snake_case_  ,							snake_case_=13  ,							snake_case_=7  ,							snake_case_=True  ,							snake_case_=True  ,							snake_case_=True  ,							snake_case_=True  ,							snake_case_=99  ,							snake_case_=16  ,							snake_case_=32  ,							snake_case_=2  ,							snake_case_=4  ,							snake_case_=37  ,							snake_case_="gelu"  ,							snake_case_=0.1  ,							snake_case_=0.1  ,							snake_case_=512  ,							snake_case_=16  ,							snake_case_=2  ,							snake_case_=0.02  ,							snake_case_=3  ,							snake_case_=4  ,							snake_case_=None  ,							)   ->       str:
													__lowerCAmelCase        =       parent
													__lowerCAmelCase        =       13
													__lowerCAmelCase        =       7
													__lowerCAmelCase        =       True
													__lowerCAmelCase        =       True
													__lowerCAmelCase        =       True
													__lowerCAmelCase        =       True
													__lowerCAmelCase        =       99
													__lowerCAmelCase        =       16
													__lowerCAmelCase        =       32
													__lowerCAmelCase        =       2
													__lowerCAmelCase        =       4
													__lowerCAmelCase        =       37
													__lowerCAmelCase        =       """gelu"""
													__lowerCAmelCase        =       0.1
													__lowerCAmelCase        =       0.1
													__lowerCAmelCase        =       512
													__lowerCAmelCase        =       16
													__lowerCAmelCase        =       2
													__lowerCAmelCase        =       0.02
													__lowerCAmelCase        =       3
													__lowerCAmelCase        =       4
													__lowerCAmelCase        =       None




							def  A__		(				self							)   ->       Tuple:
													__lowerCAmelCase        =       ids_tensor([self.batch_size, self.seq_length]  ,							self.vocab_size							)

													__lowerCAmelCase        =       None
													if self.use_input_mask:
																			__lowerCAmelCase        =       random_attention_mask([self.batch_size, self.seq_length]							)

													__lowerCAmelCase        =       None
													if self.use_token_type_ids:
																			__lowerCAmelCase        =       ids_tensor([self.batch_size, self.seq_length]  ,							self.type_vocab_size							)

													__lowerCAmelCase        =       None
													__lowerCAmelCase        =       None
													__lowerCAmelCase        =       None
													if self.use_labels:
																			__lowerCAmelCase        =       ids_tensor([self.batch_size]  ,							self.type_sequence_label_size							)
																			__lowerCAmelCase        =       ids_tensor([self.batch_size, self.seq_length]  ,							self.num_labels							)
																			__lowerCAmelCase        =       ids_tensor([self.batch_size]  ,							self.num_choices							)

													__lowerCAmelCase        =       AlbertConfig(
													    vocab_size=self.vocab_size  ,							hidden_size=self.hidden_size  ,							embedding_size=self.embedding_size  ,							num_hidden_layers=self.num_hidden_layers  ,							num_attention_heads=self.num_attention_heads  ,							intermediate_size=self.intermediate_size  ,							hidden_act=self.hidden_act  ,							hidden_dropout_prob=self.hidden_dropout_prob  ,							attention_probs_dropout_prob=self.attention_probs_dropout_prob  ,							max_position_embeddings=self.max_position_embeddings  ,							type_vocab_size=self.type_vocab_size  ,							initializer_range=self.initializer_range  ,							)

													return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_							)   ->       Any:
													__lowerCAmelCase        =       TFAlbertModel(config=lowerCAmelCase__							)
													# inputs = {'input_ids': input_ids,
													#           'attention_mask': input_mask,
													#           'token_type_ids': token_type_ids}
													# sequence_output, pooled_output = model(**inputs)
													__lowerCAmelCase        =       {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
													__lowerCAmelCase        =       model(lowerCAmelCase__							)

													__lowerCAmelCase        =       [input_ids, input_mask]
													__lowerCAmelCase        =       model(lowerCAmelCase__							)

													__lowerCAmelCase        =       model(lowerCAmelCase__							)

													self.parent.assertEqual(result.last_hidden_state.shape  ,							(self.batch_size, self.seq_length, self.hidden_size)							)
													self.parent.assertEqual(result.pooler_output.shape  ,							(self.batch_size, self.hidden_size)							)




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_							)   ->       List[str]:
													__lowerCAmelCase        =       self.num_labels
													__lowerCAmelCase        =       TFAlbertForPreTraining(config=lowerCAmelCase__							)
													__lowerCAmelCase        =       {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
													__lowerCAmelCase        =       model(lowerCAmelCase__							)
													self.parent.assertEqual(result.prediction_logits.shape  ,							(self.batch_size, self.seq_length, self.vocab_size)							)
													self.parent.assertEqual(result.sop_logits.shape  ,							(self.batch_size, self.num_labels)							)




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_							)   ->       Tuple:
													__lowerCAmelCase        =       TFAlbertForMaskedLM(config=lowerCAmelCase__							)
													__lowerCAmelCase        =       {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
													__lowerCAmelCase        =       model(lowerCAmelCase__							)
													self.parent.assertEqual(result.logits.shape  ,							(self.batch_size, self.seq_length, self.vocab_size)							)




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_							)   ->       List[str]:
													__lowerCAmelCase        =       self.num_labels
													__lowerCAmelCase        =       TFAlbertForSequenceClassification(config=lowerCAmelCase__							)
													__lowerCAmelCase        =       {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
													__lowerCAmelCase        =       model(lowerCAmelCase__							)
													self.parent.assertEqual(result.logits.shape  ,							(self.batch_size, self.num_labels)							)




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_							)   ->       List[Any]:
													__lowerCAmelCase        =       TFAlbertForQuestionAnswering(config=lowerCAmelCase__							)
													__lowerCAmelCase        =       {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
													__lowerCAmelCase        =       model(lowerCAmelCase__							)
													self.parent.assertEqual(result.start_logits.shape  ,							(self.batch_size, self.seq_length)							)
													self.parent.assertEqual(result.end_logits.shape  ,							(self.batch_size, self.seq_length)							)




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_							)   ->       str:
													__lowerCAmelCase        =       self.num_choices
													__lowerCAmelCase        =       TFAlbertForMultipleChoice(config=lowerCAmelCase__							)
													__lowerCAmelCase        =       tf.tile(tf.expand_dims(lowerCAmelCase__  ,							1							)  ,							(1, self.num_choices, 1)							)
													__lowerCAmelCase        =       tf.tile(tf.expand_dims(lowerCAmelCase__  ,							1							)  ,							(1, self.num_choices, 1)							)
													__lowerCAmelCase        =       tf.tile(tf.expand_dims(lowerCAmelCase__  ,							1							)  ,							(1, self.num_choices, 1)							)
													__lowerCAmelCase        =       {
													    """input_ids""": multiple_choice_inputs_ids,
													    """attention_mask""": multiple_choice_input_mask,
													    """token_type_ids""": multiple_choice_token_type_ids,
													}
													__lowerCAmelCase        =       model(lowerCAmelCase__							)
													self.parent.assertListEqual(list(result["""logits"""].shape							)  ,							[self.batch_size, self.num_choices]							)




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_  ,							snake_case_							)   ->       Dict:
													__lowerCAmelCase        =       self.num_labels
													__lowerCAmelCase        =       TFAlbertForTokenClassification(config=lowerCAmelCase__							)
													__lowerCAmelCase        =       {
													    """input_ids""": input_ids,
													    """attention_mask""": input_mask,
													    """token_type_ids""": token_type_ids,
													}
													__lowerCAmelCase        =       model(lowerCAmelCase__							)
													self.parent.assertListEqual(list(result["""logits"""].shape							)  ,							[self.batch_size, self.seq_length, self.num_labels]							)




							def  A__		(				self							)   ->       Optional[int]:
													__lowerCAmelCase        =       self.prepare_config_and_inputs()
													(
													    (
													    __lowerCAmelCase 
													) ,      (
													    __lowerCAmelCase 
													) ,      (
													    __lowerCAmelCase 
													) ,      (
													    __lowerCAmelCase 
													) ,      (
													    __lowerCAmelCase 
													) ,      (
													    __lowerCAmelCase 
													) ,      (
													    __lowerCAmelCase 
													) ,       
													)        =       config_and_inputs
													__lowerCAmelCase        =       {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
													return config, inputs_dict
@require_tf
class      lowerCAmelCase_						(							lowercase__							,							lowercase__							,							unittest.TestCase				):



							'''simple docstring'''





							_snake_case		     =						(
							    (
							        TFAlbertModel,
							        TFAlbertForPreTraining,
							        TFAlbertForMaskedLM,
							        TFAlbertForSequenceClassification,
							        TFAlbertForQuestionAnswering,
							        TFAlbertForTokenClassification,
							        TFAlbertForMultipleChoice,
							    )
							    if is_tf_available()
							    else ()
							)
							_snake_case		     =						(
							    {
							        '''feature-extraction''': TFAlbertModel,
							        '''fill-mask''': TFAlbertForMaskedLM,
							        '''question-answering''': TFAlbertForQuestionAnswering,
							        '''text-classification''': TFAlbertForSequenceClassification,
							        '''token-classification''': TFAlbertForTokenClassification,
							        '''zero-shot''': TFAlbertForSequenceClassification,
							    }
							    if is_tf_available()
							    else {}
							)
							_snake_case		     =						False
							_snake_case		     =						False




							def  A__		(				self  ,							snake_case_  ,							snake_case_  ,							snake_case_=False							)   ->       Optional[int]:
													__lowerCAmelCase        =       super()._prepare_for_class(lowerCAmelCase__  ,							lowerCAmelCase__  ,							return_labels=lowerCAmelCase__							)

													if return_labels:
																			if model_class in get_values(lowerCAmelCase__							):
																									__lowerCAmelCase        =       tf.zeros(self.model_tester.batch_size  ,							dtype=tf.intaa							)

													return inputs_dict




							def  A__		(				self							)   ->       Optional[Any]:
													__lowerCAmelCase        =       TFAlbertModelTester(self							)
													__lowerCAmelCase        =       ConfigTester(self  ,							config_class=lowerCAmelCase__  ,							hidden_size=37							)




							def  A__		(				self							)   ->       Tuple:
													self.config_tester.run_common_tests()




							def  A__		(				self							)   ->       Dict:
													__lowerCAmelCase        =       self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_albert_model(*lowerCAmelCase__							)




							def  A__		(				self							)   ->       Dict:
													__lowerCAmelCase        =       self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_albert_for_pretraining(*lowerCAmelCase__							)




							def  A__		(				self							)   ->       Optional[int]:
													__lowerCAmelCase        =       self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_albert_for_masked_lm(*lowerCAmelCase__							)




							def  A__		(				self							)   ->       Optional[int]:
													__lowerCAmelCase        =       self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_albert_for_multiple_choice(*lowerCAmelCase__							)




							def  A__		(				self							)   ->       Dict:
													__lowerCAmelCase        =       self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_albert_for_sequence_classification(*lowerCAmelCase__							)




							def  A__		(				self							)   ->       List[str]:
													__lowerCAmelCase        =       self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_albert_for_question_answering(*lowerCAmelCase__							)




							@slow
							def  A__		(				self							)   ->       List[str]:
													for model_name in TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																			__lowerCAmelCase        =       TFAlbertModel.from_pretrained(lowerCAmelCase__							)
																			self.assertIsNotNone(lowerCAmelCase__							)
@require_tf
class      lowerCAmelCase_						(							unittest.TestCase				):



							'''simple docstring'''





							@slow
							def  A__		(				self							)   ->       List[Any]:
													__lowerCAmelCase        =       TFAlbertForPreTraining.from_pretrained("""albert-base-v2"""							)
													__lowerCAmelCase        =       tf.constant([[0, 1, 2, 3, 4, 5]]							)
													__lowerCAmelCase        =       model(lowerCAmelCase__							)[0]

													__lowerCAmelCase        =       [1, 6, 30_000]
													self.assertEqual(output.shape  ,							lowerCAmelCase__							)

													__lowerCAmelCase        =       tf.constant(
													    [
													        [
													            [4.595_668, 0.74_462_754, -1.818_147],
													            [4.5_954_347, 0.7_454_184, -1.8_188_258],
													            [4.5_954_905, 0.7_448_235, -1.8_182_316],
													        ]
													    ]							)
													tf.debugging.assert_near(output[:, :3, :3]  ,							lowerCAmelCase__  ,							atol=1e-4							)


"""simple docstring"""
from __future__ import annotations
class      lowerCAmelCase_						:



							'''simple docstring'''





							def __init__(				self  ,							snake_case_							)   ->       None:
													__lowerCAmelCase        =       data
													__lowerCAmelCase        =       None
class      lowerCAmelCase_						:



							'''simple docstring'''





							def __init__(				self							)   ->       List[str]:
													__lowerCAmelCase        =       None




							def  A__		(				self  ,							snake_case_							)   ->       int:
													__lowerCAmelCase        =       Node(snake_case_							)
													__lowerCAmelCase        =       self.head
													__lowerCAmelCase        =       new_node
													return self.head.data




							def  A__		(				self							)   ->       int | None:
													__lowerCAmelCase        =       self.head
													__lowerCAmelCase        =       self.head
													if self.head:
																			while fast_pointer and fast_pointer.next:
																									__lowerCAmelCase        =       fast_pointer.next.next
																									__lowerCAmelCase        =       slow_pointer.next
																			return slow_pointer.data
													else:
																			print("""No element found."""							)
																			return None


if __name__ == "__main__":
			SCREAMING_SNAKE_CASE_			      =					LinkedList()
			for _ in range(int(input().strip())):
						SCREAMING_SNAKE_CASE_			      =					int(input().strip())
						link.push(data)
			print(link.middle_element())
