class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: A = None
        self.z: C = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: C = None
        self.u: B = None
        self.s: C = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
l = C("l")
k = D("k")
j = B("j")
f = C("f")
m = A("m")
i = C("i")
e = A("e")
d = D("d")

c.p = d
c.r = e
c.y = e
c.z = i
g.q = k
g.r = i
g.u = j
g.s = f
l.s = g
l.w = d
k.w = f
k.q = i
k.s = m
j.q = k
j.r = f
j.s = f
j.u = g
f.s = g
f.w = k
m.p = k
m.r = e
m.z = i
m.y = c
i.s = g
i.w = d
e.p = d
e.r = m
e.y = m
e.z = i
d.w = f
d.q = l
d.s = e
assert m.r.p.s.z.s.s.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: A = None
        self.z: C = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: C = None
        self.u: B = None
        self.s: C = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
l = C("l")
k = D("k")
j = B("j")
f = C("f")
m = A("m")
i = C("i")
e = A("e")
d = D("d")

c.p = d
c.r = e
c.y = e
c.z = i
g.q = k
g.r = i
g.u = j
g.s = f
l.s = g
l.w = d
k.w = f
k.q = i
k.s = m
j.q = k
j.r = f
j.s = f
j.u = g
f.s = g
f.w = k
m.p = k
m.r = e
m.z = i
m.y = c
i.s = g
i.w = d
e.p = d
e.r = m
e.y = m
e.z = i
d.w = f
d.q = l
d.s = e
assert m.r.p.s.z.s.s.s.r.txt == "i"