Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n := io.NextInt()
		if n == 0 {
			break
		}
		accum := make([]int, 86401)
		for i := 0; i < n; i++ {
			s, e := io.Next(), io.Next()
			hs, _ := strconv.Atoi(s[:2])
			ms, _ := strconv.Atoi(s[3:5])
			ss, _ := strconv.Atoi(s[6:8])
			accum[hs*60*60+ms*60+ss]++
			he, _ := strconv.Atoi(e[:2])
			me, _ := strconv.Atoi(e[3:5])
			se, _ := strconv.Atoi(e[6:8])
			accum[he*60*60+me*60+se]--
		}
		ans := 0
		for i := 1; i < 86401; i++ {
			accum[i] += accum[i-1]
			ans = intMax(accum[i], ans)
		}
		io.Println(ans)
	}
}

func intMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

Python: m=24*60*60
while True:
	n=int(input())
	if n==0:break
	dp=[0]*(m+1)
	for _ in range(n):
		a,d=input().split()
		a,b,c=map(int,a.split(':'));
		d,e,f=map(int,d.split(':'));
#		dp[a*3600+b*60+c]+=1
#		dp[d*3600+e*60+f]-=1
	for i in range(m):
		dp[i+1]+=dp[i]
	print(max(dp))

Python: while(1):
    n = int(input())
    if n==0: break
    table = [0 for i in range(24*60*60)]
    for i in range(n):
        s,g=input().split()
        s=list(map(int,s.split(':')))
        x=(s[0]*60+s[1])*60+s[2]
        g=list(map(int,g.split(':')))
        y=(g[0]*60+g[1])*60+g[2]
        table[x]+=1
        table[y]-=1
    ret=table[0]
    for i in range(1,24*60*60):
        table[i]+=table[i-1]
        ret=max(ret,table[i])
    print(ret)

Python: while True:
    N = int(input())
    if N == 0: break
    def to_seconds(s):
        d = 3600
        ret = 0
        for i in s.split(":"):
            ret += d * int(i)
            d //= 60
        return ret

    d = [0] * 90000
    for i in range(N):
        a, b = input().split()
        a, b = to_seconds(a), to_seconds(b)
        d[a] += 1
        d[b] -= 1

    for i in range(1, 90000):
        d[i] += d[i-1]

    print(max(d))

Python: from itertools import accumulate

def time_to_seconds(time):
    h, m, s = time.split(':')
    return int(h) * 3600 + int(m) * 60 + int(s)

ans = []
while(1):
    N = int(input())
    if N==0:
        break
    A = []
    for n in range(N):
        begin, end = input().split()
        begin = time_to_seconds(begin)
        end = time_to_seconds(end)
        A.append((begin,1))
        A.append((end,-1))
    A.sort()
    mx = 0
    cumsum = 0
    for _, x in A:
        cumsum += x
        mx = max(mx, cumsum)
    ans.append(mx)

for a in ans:
    print(a)

Python: def t2s(t):
    h = t[:2]
    m = t[3:5]
    s = t[6:]
    return int(h)*3600+int(m)*60+int(s)



while (True):
    n = int(input())
    c = [0 for i in range(24*3600+1)]
    if (n == 0):
        break
    for i in range(n):
        tt = input()
        c[t2s(tt[:8])] += 1
        c[t2s(tt[9:])] -= 1
    cc = [0]
    for i in range(len(c)):
        cc.append(cc[-1] + c[i])
    print(max(cc))

Python: # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2013

from itertools import accumulate

def getsec(s):
    # hh:mm:ss 23:59:59までかな 23*3600+59*60+59=86399
    h, m, s = map(int, s.split(":"))
    return h * 3600 + m * 60 + s

def solve(n):
    A = [0] * 90000
    for _ in range(n):
        ai, bi = input().split()
        ai, bi = getsec(ai), getsec(bi)
        A[ai] += 1
        A[bi] -= 1
    
    cA = accumulate(A)
    print(max(cA))


while True:
    n = int(input())
    if n == 0:
        break
    solve(n)

Python: while True:
    n = int(input())
    if not n: break
    cnt = [0]*(60**3+1)
    for i in range(n):
        dep,arr = input().split()
        h,m,s = map(int,dep.split(":"))
        cnt[h*3600+m*60+s] += 1
        h,m,s = map(int,arr.split(":"))
        cnt[h*3600+m*60+s] -= 1
    for i in range(1,60**3+1): cnt[i] += cnt[i-1]
    print(max(cnt))

Python: def time_to_i(s):
    tt = list(map(int, s.split(':')))
    return tt[0] * 3600 + tt[1] * 60 + tt[2]

while True:
    n = int(input())
    if n == 0: break
    tmp = []
    for i in range(n):
        tmp.append(input().split())
    table = []
    for t in tmp:
        table.append((time_to_i(t[0]), 0))
        table.append((time_to_i(t[1]), 1))
    table.sort(key=lambda x:x[0])
    trains = 1
    for t in table:
        if t[1] == 0:
            if trains > 0:
                trains -= 1
        else:
            trains += 1
    print(trains)

Python: from itertools import accumulate


def get_second(time_str):
    return int(time_str[:2]) * 3600 + int(time_str[3:5]) * 60 + int(time_str[6:])


while True:
    n = int(input())
    if n == 0:
        break
    cnt = [0] * 86400
    for _ in range(n):
        dep_str, arr_str = input().strip().split()
        dep, arr = get_second(dep_str), get_second(arr_str)
        cnt[dep] += 1
        cnt[arr] -= 1
    print(max(accumulate(cnt)))

Python: while True:
    n = int(input())
    if n == 0:
        break
    times = [[0] * 2 for i in range(n)]
    for i in range(n):
        l, a = input().split()
        lh, lm, ls = map(int, l.split(":"))
        ah, am, ass = map(int, a.split(":"))
        times[i][0] = lh * 3600 + lm * 60 + ls
        times[i][1] = ah * 3600 + am * 60 + ass
    times.sort(key = lambda x:x[1])
    ans = 0
    arrive = 60 * 60 * 24
    for i in range(n):
        if times[i][0] < arrive:
            arrive = times[i][1]
            ans += 1
    print(ans)

Python: def seconds(a):
    hour,minute,second=a.split(":")
    hour,minute,second=int(hour),int(minute),int(second)
    return(3600*hour+60*minute+second)

from itertools import accumulate
while True:
    n=int(input())
    if n==0:
        exit()
    memo=[0]*86401
    for i in range(n):
        l,r=input().split()
        l=seconds(l)
        r=seconds(r)
        memo[l+1]+=1
        if r!=86400:
            memo[r+1]-=1
    ac=list(accumulate(memo))
    print(max(ac))