class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

m = A("m")
g = B("g")
k = C("k")
a = C("a")
l = A("l")
e = C("e")
j = A("j")
b = A("b")
h = B("h")
n = B("n")

m.u = a
m.p = l
g.p = a
g.s = a
g.r = l
k.q = n
k.s = m
k.p = l
a.q = h
a.s = l
a.p = l
l.u = k
l.p = b
e.q = h
e.s = b
e.p = l
j.u = e
j.p = l
b.u = e
b.p = m
h.p = e
h.s = a
h.r = b
n.p = k
n.s = k
n.r = m
assert k.p.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

m = A("m")
g = B("g")
k = C("k")
a = C("a")
l = A("l")
e = C("e")
j = A("j")
b = A("b")
h = B("h")
n = B("n")

m.u = a
m.p = l
g.p = a
g.s = a
g.r = l
k.q = n
k.s = m
k.p = l
a.q = h
a.s = l
a.p = l
l.u = k
l.p = b
e.q = h
e.s = b
e.p = l
j.u = e
j.p = l
b.u = e
b.p = m
h.p = e
h.s = a
h.r = b
n.p = k
n.s = k
n.r = m
assert k.p.p.u.txt == "e"