

import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin


if is_torch_available():
 import torch

if is_vision_available():
 from PIL import Image

 from transformers import TvltImageProcessor
def 						UpperCamelCase_(			snake_case__:  Any  ,    snake_case__:  Any=10  ,    snake_case__:  Any=10  ,    snake_case__:  List[str]=False  ,    snake_case__:  List[Any]=False   )       -> Dict:
 UpperCAmelCase__							=				[]
 for i in range(image_processor_tester.num_frames   ):
  video.append(np.random.randint(2_55  ,    size=(image_processor_tester.num_channels, width, height)  ,    dtype=np.uinta   )   )

 if not numpify and not torchify:
  # PIL expects the channel dimension as last dimension
  UpperCAmelCase__							=				[Image.fromarray(np.moveaxis(snake_case__  ,    0  ,    -1   )   ) for frame in video]

 if torchify:
  UpperCAmelCase__							=				[torch.from_numpy(snake_case__   ) for frame in video]

 return video
def 						UpperCamelCase_(			snake_case__:  Optional[Any]  ,    snake_case__:  List[str]=False  ,    snake_case__:  Union[str, Any]=False  ,    snake_case__:  List[str]=False   )       -> Any:
 assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

 UpperCAmelCase__							=				[]
 for i in range(image_processor_tester.batch_size   ):
  if equal_resolution:
   UpperCAmelCase__							=				UpperCAmelCase__							=				image_processor_tester.max_resolution
  else:
   UpperCAmelCase__				,    UpperCAmelCase__							=				np.random.choice(
       np.arange(image_processor_tester.min_resolution  ,    image_processor_tester.max_resolution   )  ,    2   )
   UpperCAmelCase__							=				prepare_video(
       image_processor_tester=snake_case__  ,    width=snake_case__  ,    height=snake_case__  ,    numpify=snake_case__  ,    torchify=snake_case__  ,    )
  video_inputs.append(snake_case__   )

 return video_inputs



class     lowercase						(       unittest.TestCase					):



 '''simple docstring'''


 def __init__(self       ,       __a       ,       __a=7       ,       __a=3       ,       __a=4       ,       __a=18       ,       __a=30       ,       __a=400       ,       __a=True       ,       __a=None       ,       __a=True       ,       __a=[0.5, 0.5, 0.5]       ,       __a=[0.5, 0.5, 0.5]       ,       __a=True       ,       __a=None       ,       ) ->					List[Any]:






  """simple docstring"""





  UpperCAmelCase__							=				size if size is not None else {'shortest_edge': 18}
  UpperCAmelCase__							=				crop_size if crop_size is not None else {'height': 18, 'width': 18}

  UpperCAmelCase__							=				parent
  UpperCAmelCase__							=				batch_size
  UpperCAmelCase__							=				num_channels
  UpperCAmelCase__							=				num_frames
  UpperCAmelCase__							=				image_size
  UpperCAmelCase__							=				min_resolution
  UpperCAmelCase__							=				max_resolution
  UpperCAmelCase__							=				do_resize
  UpperCAmelCase__							=				size
  UpperCAmelCase__							=				do_normalize
  UpperCAmelCase__							=				image_mean
  UpperCAmelCase__							=				image_std
  UpperCAmelCase__							=				do_center_crop
  UpperCAmelCase__							=				crop_size




 def   UpperCamelCase__							(self ) ->					str:






  """simple docstring"""





  return {
      "image_mean": self.image_mean,
      "image_std": self.image_std,
      "do_normalize": self.do_normalize,
      "do_resize": self.do_resize,
      "size": self.size,
      "do_center_crop": self.do_center_crop,
      "crop_size": self.crop_size,
  }







@require_torch
@require_vision
class     lowercase						(       _UpperCamelCase ,				unittest.TestCase					):



 '''simple docstring'''


 __SCREAMING_SNAKE_CASE												=				TvltImageProcessor if is_vision_available() else None




 def   UpperCamelCase__							(self ) ->					Optional[int]:






  """simple docstring"""





  UpperCAmelCase__							=				TvltImageProcessorTester(self )




 @property
 def   UpperCamelCase__							(self ) ->					str:






  """simple docstring"""





  return self.image_processor_tester.prepare_image_processor_dict()




 def   UpperCamelCase__							(self ) ->					str:






  """simple docstring"""





  UpperCAmelCase__							=				self.image_processing_class(**self.image_processor_dict )
  self.assertTrue(hasattr(__a       ,       'image_mean' ) )
  self.assertTrue(hasattr(__a       ,       'image_std' ) )
  self.assertTrue(hasattr(__a       ,       'do_normalize' ) )
  self.assertTrue(hasattr(__a       ,       'do_resize' ) )
  self.assertTrue(hasattr(__a       ,       'do_center_crop' ) )
  self.assertTrue(hasattr(__a       ,       'size' ) )




 def   UpperCamelCase__							(self ) ->					Tuple:






  """simple docstring"""





  UpperCAmelCase__							=				self.image_processing_class(**self.image_processor_dict )
  # create random PIL videos
  UpperCAmelCase__							=				prepare_video_inputs(self.image_processor_tester       ,       equal_resolution=__a )
  for video in video_inputs:
   self.assertIsInstance(__a       ,       __a )
   self.assertIsInstance(video[0]       ,       Image.Image )

  # Test not batched input
  UpperCAmelCase__							=				image_processor(video_inputs[0]       ,       return_tensors='pt' ).pixel_values
  self.assertEqual(
      encoded_videos.shape       ,       (
          1,
          self.image_processor_tester.num_frames,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size['height'],
          self.image_processor_tester.crop_size['width'],
      )       ,       )

  # Test batched
  UpperCAmelCase__							=				image_processor(__a       ,       return_tensors='pt' ).pixel_values
  self.assertEqual(
      encoded_videos.shape       ,       (
          self.image_processor_tester.batch_size,
          self.image_processor_tester.num_frames,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size['height'],
          self.image_processor_tester.crop_size['width'],
      )       ,       )




 def   UpperCamelCase__							(self ) ->					Tuple:






  """simple docstring"""





  UpperCAmelCase__							=				self.image_processing_class(**self.image_processor_dict )
  # create random numpy tensors
  UpperCAmelCase__							=				prepare_video_inputs(self.image_processor_tester       ,       equal_resolution=__a       ,       numpify=__a )
  for video in video_inputs:
   self.assertIsInstance(__a       ,       __a )
   self.assertIsInstance(video[0]       ,       np.ndarray )

  # Test not batched input
  UpperCAmelCase__							=				image_processor(video_inputs[0]       ,       return_tensors='pt' ).pixel_values
  self.assertEqual(
      encoded_videos.shape       ,       (
          1,
          self.image_processor_tester.num_frames,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size['height'],
          self.image_processor_tester.crop_size['width'],
      )       ,       )

  # Test batched
  UpperCAmelCase__							=				image_processor(__a       ,       return_tensors='pt' ).pixel_values
  self.assertEqual(
      encoded_videos.shape       ,       (
          self.image_processor_tester.batch_size,
          self.image_processor_tester.num_frames,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size['height'],
          self.image_processor_tester.crop_size['width'],
      )       ,       )




 def   UpperCamelCase__							(self ) ->					List[str]:






  """simple docstring"""





  UpperCAmelCase__							=				self.image_processing_class(**self.image_processor_dict )
  # create random PyTorch tensors
  UpperCAmelCase__							=				prepare_video_inputs(self.image_processor_tester       ,       equal_resolution=__a       ,       torchify=__a )
  for video in video_inputs:
   self.assertIsInstance(__a       ,       __a )
   self.assertIsInstance(video[0]       ,       torch.Tensor )

  # Test not batched input
  UpperCAmelCase__							=				image_processor(video_inputs[0]       ,       return_tensors='pt' ).pixel_values
  self.assertEqual(
      encoded_videos.shape       ,       (
          1,
          self.image_processor_tester.num_frames,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size['height'],
          self.image_processor_tester.crop_size['width'],
      )       ,       )

  # Test batched
  UpperCAmelCase__							=				image_processor(__a       ,       return_tensors='pt' ).pixel_values
  self.assertEqual(
      encoded_videos.shape       ,       (
          self.image_processor_tester.batch_size,
          self.image_processor_tester.num_frames,
          self.image_processor_tester.num_channels,
          self.image_processor_tester.crop_size['height'],
          self.image_processor_tester.crop_size['width'],
      )       ,       )







from __future__ import annotations


class        A_					:




      '''simple docstring'''


      def __init__(				self:       Union[str, Any]						,      a:       int				):
       __lowerCamelCase		:							List[Any]							=						data
       __lowerCamelCase		:							Optional[Any]							=						None



class        A_					:




      '''simple docstring'''


      def __init__(				self:       Dict				):
       __lowerCamelCase		:							Dict							=						None




      def      _snake_case	(				self:       Dict						,      a:       int				):
       __lowerCamelCase		:							List[Any]							=						Node(a				)
       __lowerCamelCase		:							Dict							=						self.head
       __lowerCamelCase		:							Optional[int]							=						new_node
       return self.head.data




      def      _snake_case	(				self:       Optional[Any]				):
       __lowerCamelCase		:							Union[str, Any]							=						self.head
       __lowerCamelCase		:							List[Any]							=						self.head
       if self.head:
        while fast_pointer and fast_pointer.next:
         __lowerCamelCase		:							Any							=						fast_pointer.next.next
         __lowerCamelCase		:							str							=						slow_pointer.next
        return slow_pointer.data
       else:
        print('No element found.'				)
        return None


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

