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

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: A = None
        self.z: B = None
        self.txt = txt

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

n = A("n")
m = B("m")
j = C("j")
d = C("d")
k = C("k")
b = C("b")
i = B("i")
l = A("l")
g = B("g")
c = C("c")

n.r = i
n.s = i
m.r = g
m.x = l
m.z = i
j.p = c
j.w = l
j.s = n
d.p = j
d.w = l
d.s = l
k.p = b
k.w = l
k.s = n
b.p = j
b.w = l
b.s = l
i.r = g
i.x = l
i.z = m
l.r = g
l.s = g
g.r = m
g.x = n
g.z = i
c.p = j
c.w = n
c.s = l
assert c.w.s.r.r.x.s.r.z.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: A = None
        self.z: B = None
        self.txt = txt

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

n = A("n")
m = B("m")
j = C("j")
d = C("d")
k = C("k")
b = C("b")
i = B("i")
l = A("l")
g = B("g")
c = C("c")

n.r = i
n.s = i
m.r = g
m.x = l
m.z = i
j.p = c
j.w = l
j.s = n
d.p = j
d.w = l
d.s = l
k.p = b
k.w = l
k.s = n
b.p = j
b.w = l
b.s = l
i.r = g
i.x = l
i.z = m
l.r = g
l.s = g
g.r = m
g.x = n
g.z = i
c.p = j
c.w = n
c.s = l
assert c.w.s.r.r.x.s.r.z.r.z.txt == "i"