
"""simple docstring"""

from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

SCREAMING_SNAKE_CASE_			    =  '''https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true'''




def 			lowercase__  (    lowerCAmelCase :    str       , lowerCAmelCase :    str       )       ->					list | None:






    """simple docstring"""




    try:
        # Has user provided both inputs?
        if not drug_name or not zip_code:
            return None

        UpperCAmelCase  	=    BASE_URL.format(lowerCAmelCase       , lowerCAmelCase       )
        UpperCAmelCase  	=    get(lowerCAmelCase       )

        # Is the response ok?
        response.raise_for_status()

        # Scrape the data using bs4
        UpperCAmelCase  	=    BeautifulSoup(response.text       , 'html.parser'       )

        # This list will store the name and price.
        UpperCAmelCase  	=    []

        # Fetch all the grids that contains the items.
        UpperCAmelCase  	=    soup.find_all('div'       , {'class': 'grid-x pharmCard'}       )
        if grid_list and len(lowerCAmelCase       ) > 0:
            for grid in grid_list:
                # Get the pharmacy price.
                UpperCAmelCase  	=    grid.find('p'       , {'class': 'list-title'}       ).text

                # Get price of the drug.
                UpperCAmelCase  	=    grid.find('span'       , {'p', 'price price-large'}       ).text

                pharmacy_price_list.append(
                    {
                        'pharmacy_name': pharmacy_name,
                        'price': price,
                    }       )

        return pharmacy_price_list

    except (HTTPError, exceptions.RequestException, ValueError):
        return None


if __name__ == "__main__":
   # Enter a drug name and a zip code
   SCREAMING_SNAKE_CASE_			    =  input('''Enter drug name: ''').strip()
   SCREAMING_SNAKE_CASE_			    =  input('''Enter zip code: ''').strip()

   SCREAMING_SNAKE_CASE_			    =  fetch_pharmacy_and_price_list(
       drug_name, zip_code
   )

   if pharmacy_price_list:
      print(F'\nSearch results for {drug_name} at location {zip_code}:')
      for pharmacy_price in pharmacy_price_list:
         SCREAMING_SNAKE_CASE_			    =  pharmacy_price['''pharmacy_name''']
         SCREAMING_SNAKE_CASE_			    =  pharmacy_price['''price''']

         print(F'Pharmacy: {name} Price: {price}')
   else:
      print(F'No results found for {drug_name}')





"""simple docstring"""

from __future__ import annotations




def 			lowercase__  (    lowerCAmelCase :    Dict       )       ->					Optional[int]:






    """simple docstring"""




    global graph, reversed_graph, scc, component, visit, stack
    if visit[u]:
        return
    UpperCAmelCase  	=    True
    for v in graph[u]:
        dfs(lowerCAmelCase       )
    stack.append(lowerCAmelCase       )




def 			lowercase__  (    lowerCAmelCase :    Optional[int]       )       ->					int:






    """simple docstring"""




    global graph, reversed_graph, scc, component, visit, stack
    if visit[u]:
        return
    UpperCAmelCase  	=    True
    component.append(lowerCAmelCase       )
    for v in reversed_graph[u]:
        dfsa(lowerCAmelCase       )




def 			lowercase__  (    )       ->					List[str]:






    """simple docstring"""




    global graph, reversed_graph, scc, component, visit, stack
    for i in range(lowerCAmelCase       ):
        dfs(lowerCAmelCase       )
    UpperCAmelCase  	=    [False] * n
    for i in stack[::-1]:
        if visit[i]:
            continue
        UpperCAmelCase  	=    []
        dfsa(lowerCAmelCase       )
        scc.append(lowerCAmelCase       )
    return scc


if __name__ == "__main__":
   # n - no of nodes, m - no of edges
   SCREAMING_SNAKE_CASE_    ,  SCREAMING_SNAKE_CASE_			    =  list(map(int, input().strip().split()))

   SCREAMING_SNAKE_CASE_			    =  [[] for _ in range(n)]  # graph
   SCREAMING_SNAKE_CASE_			    =  [[] for i in range(n)]  # reversed graph
   # input graph data (edges)
   for _ in range(m):
      SCREAMING_SNAKE_CASE_    ,  SCREAMING_SNAKE_CASE_			    =  list(map(int, input().strip().split()))
      graph[u].append(v)
      reversed_graph[v].append(u)

   SCREAMING_SNAKE_CASE_			    =  []
   SCREAMING_SNAKE_CASE_			    =  [False] * n
   SCREAMING_SNAKE_CASE_			    =  []
   SCREAMING_SNAKE_CASE_			    =  []
   print(kosaraju())



