# -*- coding: utf-8 -*-
import io,sys,ssl,urllib.request,re
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding="utf-8")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
def get(u):
    req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0"})
    with urllib.request.urlopen(req,timeout=25,context=ctx) as r:
        return r.status,r.read().decode("utf-8","replace")
def clean(h):
    t=re.sub(r"<script[\s\S]*?</script>","",h)
    t=re.sub(r"<style[\s\S]*?</style>","",t)
    t=re.sub(r"<[^>]+>"," ",t); return re.sub(r"\s+"," ",t)
st,h=get("https://macss.uchicago.edu/programs-of-study/macss-general-curriculum"); t=clean(h)
i=t.find("In their first year")
print("### GENERAL CORE"); print(t[i:i+1600]); print()
st,h=get("https://macss.uchicago.edu/programs-study/advanced-standing-track"); t2=clean(h)
j=t2.find("Advanced Standing students")
print("### ADV STANDING"); print(t2[max(0,j-300):j+900]); print()
st,h=get("https://macss.uchicago.edu/apply/student-outcomes"); t3=clean(h)
k=t3.find("88%")
print("### OUTCOMES"); print(t3[k-200:k+1800])
