





from collections import deque
from math import floor
from random import random
from time import time

class 		SCREAMING_SNAKE_CASE__    :


						def __init__(self	:				Tuple				):





									"""simple docstring"""



									__snake_case								=       {}


						def        a			(self	:				List[str]    ,      a__	:				Optional[int]    ,      a__	:				Dict    ,      a__	:				Optional[int]=1				):





									"""simple docstring"""



									if self.graph.get(lowerCAmelCase_				):
												if self.graph[u].count([w, v]				) == 0:
															self.graph[u].append([w, v]				)
									else:
												__snake_case								=       [[w, v]]
									if not self.graph.get(lowerCAmelCase_				):
												__snake_case								=       []


						def        a			(self	:				Optional[Any]				):





									"""simple docstring"""



									return list(self.graph				)


						def        a			(self	:				Any    ,      a__	:				Dict    ,      a__	:				int				):





									"""simple docstring"""



									if self.graph.get(lowerCAmelCase_				):
												for _ in self.graph[u]:
															if _[1] == v:
																		self.graph[u].remove(lowerCAmelCase_				)


						def        a			(self	:				str    ,      a__	:				List[Any]=-2    ,      a__	:				Any=-1				):





									"""simple docstring"""



									if s == d:
												return []
									__snake_case								=       []
									__snake_case								=       []
									if s == -2:
												__snake_case								=       list(self.graph				)[0]
									stack.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									__snake_case								=       s

									while True:
												# check if there is any non isolated nodes
												if len(self.graph[s]				) != 0:
															__snake_case								=       s
															for node in self.graph[s]:
																		if visited.count(node[1]				) < 1:
																					if node[1] == d:
																								visited.append(lowerCAmelCase_				)
																								return visited
																					else:
																								stack.append(node[1]				)
																								visited.append(node[1]				)
																								__snake_case								=       node[1]
																								break

            # check if all the children are visited
												if s == ss:
															stack.pop()
															if len(lowerCAmelCase_				) != 0:
																		__snake_case								=       stack[len(lowerCAmelCase_				) - 1]
												else:
															__snake_case								=       ss

												# check if se have reached the starting point
												if len(lowerCAmelCase_				) == 0:
															return visited


						def        a			(self	:				List[str]    ,      a__	:				List[str]=-1				):





									"""simple docstring"""



									if c == -1:
												__snake_case								=       floor(random() * 1_0000				) + 10
									for i in range(lowerCAmelCase_				):
												# every vertex has max 100 edges
												for _ in range(floor(random() * 102				) + 1				):
															__snake_case								=       floor(random() * c				) + 1
															if n != i:
																		self.add_pair(lowerCAmelCase_    ,      lowerCAmelCase_    ,      1				)


						def        a			(self	:				Dict    ,      a__	:				int=-2				):





									"""simple docstring"""



									__snake_case								=       deque()
									__snake_case								=       []
									if s == -2:
												__snake_case								=       list(self.graph				)[0]
									d.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									while d:
												__snake_case								=       d.popleft()
												if len(self.graph[s]				) != 0:
															for node in self.graph[s]:
																		if visited.count(node[1]				) < 1:
																					d.append(node[1]				)
																					visited.append(node[1]				)
									return visited


						def        a			(self	:				List[str]    ,      a__	:				Any				):





									"""simple docstring"""



									__snake_case								=       0
									for x in self.graph:
												for y in self.graph[x]:
															if y[1] == u:
																		count += 1
									return count


						def        a			(self	:				Dict    ,      a__	:				List[Any]				):





									"""simple docstring"""



									return len(self.graph[u]				)


						def        a			(self	:				Dict    ,      a__	:				Optional[int]=-2				):





									"""simple docstring"""



									__snake_case								=       []
									__snake_case								=       []
									if s == -2:
												__snake_case								=       list(self.graph				)[0]
									stack.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									__snake_case								=       s
									__snake_case								=       []

									while True:
												# check if there is any non isolated nodes
												if len(self.graph[s]				) != 0:
															__snake_case								=       s
															for node in self.graph[s]:
																		if visited.count(node[1]				) < 1:
																					stack.append(node[1]				)
																					visited.append(node[1]				)
																					__snake_case								=       node[1]
																					break

            # check if all the children are visited
												if s == ss:
															sorted_nodes.append(stack.pop()				)
															if len(lowerCAmelCase_				) != 0:
																		__snake_case								=       stack[len(lowerCAmelCase_				) - 1]
												else:
															__snake_case								=       ss

												# check if se have reached the starting point
												if len(lowerCAmelCase_				) == 0:
															return sorted_nodes


						def        a			(self	:				Any				):





									"""simple docstring"""



									__snake_case								=       []
									__snake_case								=       []
									__snake_case								=       list(self.graph				)[0]
									stack.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									__snake_case								=       -2
									__snake_case								=       []
									__snake_case								=       s
									__snake_case								=       False
									__snake_case								=       set()

									while True:
												# check if there is any non isolated nodes
												if len(self.graph[s]				) != 0:
															__snake_case								=       s
															for node in self.graph[s]:
																		if (
																		    visited.count(node[1]				) > 0
																		    and node[1] != parent
																		    and indirect_parents.count(node[1]				) > 0
																		    and not on_the_way_back
																		):
																					__snake_case								=       len(lowerCAmelCase_				) - 1
																					while len_stack >= 0:
																								if stack[len_stack] == node[1]:
																											anticipating_nodes.add(node[1]				)
																											break
																								else:
																											anticipating_nodes.add(stack[len_stack]				)
																											len_stack -= 1
																		if visited.count(node[1]				) < 1:
																					stack.append(node[1]				)
																					visited.append(node[1]				)
																					__snake_case								=       node[1]
																					break

            # check if all the children are visited
												if s == ss:
															stack.pop()
															__snake_case								=       True
															if len(lowerCAmelCase_				) != 0:
																		__snake_case								=       stack[len(lowerCAmelCase_				) - 1]
												else:
															__snake_case								=       False
															indirect_parents.append(lowerCAmelCase_				)
															__snake_case								=       s
															__snake_case								=       ss

												# check if se have reached the starting point
												if len(lowerCAmelCase_				) == 0:
															return list(lowerCAmelCase_				)


						def        a			(self	:				Any				):





									"""simple docstring"""



									__snake_case								=       []
									__snake_case								=       []
									__snake_case								=       list(self.graph				)[0]
									stack.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									__snake_case								=       -2
									__snake_case								=       []
									__snake_case								=       s
									__snake_case								=       False
									__snake_case								=       set()

									while True:
												# check if there is any non isolated nodes
												if len(self.graph[s]				) != 0:
															__snake_case								=       s
															for node in self.graph[s]:
																		if (
																		    visited.count(node[1]				) > 0
																		    and node[1] != parent
																		    and indirect_parents.count(node[1]				) > 0
																		    and not on_the_way_back
																		):
																					__snake_case								=       len(lowerCAmelCase_				) - 1
																					while len_stack_minus_one >= 0:
																								if stack[len_stack_minus_one] == node[1]:
																											anticipating_nodes.add(node[1]				)
																											break
																								else:
																											return True
																		if visited.count(node[1]				) < 1:
																					stack.append(node[1]				)
																					visited.append(node[1]				)
																					__snake_case								=       node[1]
																					break

            # check if all the children are visited
												if s == ss:
															stack.pop()
															__snake_case								=       True
															if len(lowerCAmelCase_				) != 0:
																		__snake_case								=       stack[len(lowerCAmelCase_				) - 1]
												else:
															__snake_case								=       False
															indirect_parents.append(lowerCAmelCase_				)
															__snake_case								=       s
															__snake_case								=       ss

												# check if se have reached the starting point
												if len(lowerCAmelCase_				) == 0:
															return False


						def        a			(self	:				Any    ,      a__	:				Tuple=-2    ,      a__	:				List[Any]=-1				):





									"""simple docstring"""



									__snake_case								=       time()
									self.dfs(lowerCAmelCase_    ,      lowerCAmelCase_				)
									__snake_case								=       time()
									return end - begin


						def        a			(self	:				List[str]    ,      a__	:				str=-2				):





									"""simple docstring"""



									__snake_case								=       time()
									self.bfs(lowerCAmelCase_				)
									__snake_case								=       time()
									return end - begin






class 		SCREAMING_SNAKE_CASE__    :


						def __init__(self	:				Dict				):





									"""simple docstring"""



									__snake_case								=       {}


						def        a			(self	:				List[str]    ,      a__	:				Any    ,      a__	:				Optional[Any]    ,      a__	:				Union[str, Any]=1				):





									"""simple docstring"""



									if self.graph.get(lowerCAmelCase_				):
												# if there already is a edge
												if self.graph[u].count([w, v]				) == 0:
															self.graph[u].append([w, v]				)
									else:
												# if u does not exist
												__snake_case								=       [[w, v]]
									# add the other way
									if self.graph.get(lowerCAmelCase_				):
												# if there already is a edge
												if self.graph[v].count([w, u]				) == 0:
															self.graph[v].append([w, u]				)
									else:
												# if u does not exist
												__snake_case								=       [[w, u]]


						def        a			(self	:				str    ,      a__	:				Optional[int]    ,      a__	:				Optional[int]				):





									"""simple docstring"""



									if self.graph.get(lowerCAmelCase_				):
												for _ in self.graph[u]:
															if _[1] == v:
																		self.graph[u].remove(lowerCAmelCase_				)
        # the other way round
									if self.graph.get(lowerCAmelCase_				):
												for _ in self.graph[v]:
															if _[1] == u:
																		self.graph[v].remove(lowerCAmelCase_				)


						def        a			(self	:				Union[str, Any]    ,      a__	:				Any=-2    ,      a__	:				str=-1				):





									"""simple docstring"""



									if s == d:
												return []
									__snake_case								=       []
									__snake_case								=       []
									if s == -2:
												__snake_case								=       list(self.graph				)[0]
									stack.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									__snake_case								=       s

									while True:
												# check if there is any non isolated nodes
												if len(self.graph[s]				) != 0:
															__snake_case								=       s
															for node in self.graph[s]:
																		if visited.count(node[1]				) < 1:
																					if node[1] == d:
																								visited.append(lowerCAmelCase_				)
																								return visited
																					else:
																								stack.append(node[1]				)
																								visited.append(node[1]				)
																								__snake_case								=       node[1]
																								break

            # check if all the children are visited
												if s == ss:
															stack.pop()
															if len(lowerCAmelCase_				) != 0:
																		__snake_case								=       stack[len(lowerCAmelCase_				) - 1]
												else:
															__snake_case								=       ss

												# check if se have reached the starting point
												if len(lowerCAmelCase_				) == 0:
															return visited


						def        a			(self	:				Tuple    ,      a__	:				Union[str, Any]=-1				):





									"""simple docstring"""



									if c == -1:
												__snake_case								=       floor(random() * 1_0000				) + 10
									for i in range(lowerCAmelCase_				):
												# every vertex has max 100 edges
												for _ in range(floor(random() * 102				) + 1				):
															__snake_case								=       floor(random() * c				) + 1
															if n != i:
																		self.add_pair(lowerCAmelCase_    ,      lowerCAmelCase_    ,      1				)


						def        a			(self	:				List[Any]    ,      a__	:				Tuple=-2				):





									"""simple docstring"""



									__snake_case								=       deque()
									__snake_case								=       []
									if s == -2:
												__snake_case								=       list(self.graph				)[0]
									d.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									while d:
												__snake_case								=       d.popleft()
												if len(self.graph[s]				) != 0:
															for node in self.graph[s]:
																		if visited.count(node[1]				) < 1:
																					d.append(node[1]				)
																					visited.append(node[1]				)
									return visited


						def        a			(self	:				Tuple    ,      a__	:				List[str]				):





									"""simple docstring"""



									return len(self.graph[u]				)


						def        a			(self	:				Union[str, Any]				):





									"""simple docstring"""



									__snake_case								=       []
									__snake_case								=       []
									__snake_case								=       list(self.graph				)[0]
									stack.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									__snake_case								=       -2
									__snake_case								=       []
									__snake_case								=       s
									__snake_case								=       False
									__snake_case								=       set()

									while True:
												# check if there is any non isolated nodes
												if len(self.graph[s]				) != 0:
															__snake_case								=       s
															for node in self.graph[s]:
																		if (
																		    visited.count(node[1]				) > 0
																		    and node[1] != parent
																		    and indirect_parents.count(node[1]				) > 0
																		    and not on_the_way_back
																		):
																					__snake_case								=       len(lowerCAmelCase_				) - 1
																					while len_stack >= 0:
																								if stack[len_stack] == node[1]:
																											anticipating_nodes.add(node[1]				)
																											break
																								else:
																											anticipating_nodes.add(stack[len_stack]				)
																											len_stack -= 1
																		if visited.count(node[1]				) < 1:
																					stack.append(node[1]				)
																					visited.append(node[1]				)
																					__snake_case								=       node[1]
																					break

            # check if all the children are visited
												if s == ss:
															stack.pop()
															__snake_case								=       True
															if len(lowerCAmelCase_				) != 0:
																		__snake_case								=       stack[len(lowerCAmelCase_				) - 1]
												else:
															__snake_case								=       False
															indirect_parents.append(lowerCAmelCase_				)
															__snake_case								=       s
															__snake_case								=       ss

												# check if se have reached the starting point
												if len(lowerCAmelCase_				) == 0:
															return list(lowerCAmelCase_				)


						def        a			(self	:				str				):





									"""simple docstring"""



									__snake_case								=       []
									__snake_case								=       []
									__snake_case								=       list(self.graph				)[0]
									stack.append(lowerCAmelCase_				)
									visited.append(lowerCAmelCase_				)
									__snake_case								=       -2
									__snake_case								=       []
									__snake_case								=       s
									__snake_case								=       False
									__snake_case								=       set()

									while True:
												# check if there is any non isolated nodes
												if len(self.graph[s]				) != 0:
															__snake_case								=       s
															for node in self.graph[s]:
																		if (
																		    visited.count(node[1]				) > 0
																		    and node[1] != parent
																		    and indirect_parents.count(node[1]				) > 0
																		    and not on_the_way_back
																		):
																					__snake_case								=       len(lowerCAmelCase_				) - 1
																					while len_stack_minus_one >= 0:
																								if stack[len_stack_minus_one] == node[1]:
																											anticipating_nodes.add(node[1]				)
																											break
																								else:
																											return True
																		if visited.count(node[1]				) < 1:
																					stack.append(node[1]				)
																					visited.append(node[1]				)
																					__snake_case								=       node[1]
																					break

            # check if all the children are visited
												if s == ss:
															stack.pop()
															__snake_case								=       True
															if len(lowerCAmelCase_				) != 0:
																		__snake_case								=       stack[len(lowerCAmelCase_				) - 1]
												else:
															__snake_case								=       False
															indirect_parents.append(lowerCAmelCase_				)
															__snake_case								=       s
															__snake_case								=       ss

												# check if se have reached the starting point
												if len(lowerCAmelCase_				) == 0:
															return False


						def        a			(self	:				List[Any]				):





									"""simple docstring"""



									return list(self.graph				)


						def        a			(self	:				Optional[Any]    ,      a__	:				List[Any]=-2    ,      a__	:				List[Any]=-1				):





									"""simple docstring"""



									__snake_case								=       time()
									self.dfs(lowerCAmelCase_    ,      lowerCAmelCase_				)
									__snake_case								=       time()
									return end - begin


						def        a			(self	:				List[Any]    ,      a__	:				int=-2				):





									"""simple docstring"""



									__snake_case								=       time()
									self.bfs(lowerCAmelCase_				)
									__snake_case								=       time()
									return end - begin








from pathlib import Path

import fire






def lowerCamelCase__   (							snake_case_     :  str	,				snake_case_     :  str	,				snake_case_     :  int	)				->    str:
   __snake_case								=       Path(snake_case_	)
   __snake_case								=       Path(snake_case_	)
   dest_dir.mkdir(exist_ok=snake_case_	)
   for path in src_dir.iterdir():
      __snake_case								=       [x.rstrip() for x in list(path.open().readlines()	)][:n]
      __snake_case								=       dest_dir.joinpath(path.name	)
      print(snake_case_	)
      dest_path.open('''w'''	).write('''\n'''.join(snake_case_	)	)


if __name__ == "__main__":
    fire.Fire(minify)

