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

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

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

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

i = A("i")
a = B("a")
b = C("b")
g = D("g")
m = C("m")
n = B("n")
k = C("k")
c = A("c")
j = D("j")

i.r = c
i.z = c
i.w = c
i.s = a
a.r = b
a.y = k
b.o = n
b.p = j
b.y = k
b.s = g
g.v = k
g.q = n
m.o = n
m.p = j
m.s = j
m.y = b
n.r = m
n.y = k
k.o = a
k.p = j
k.s = j
k.y = b
c.r = i
c.z = i
c.w = i
c.s = n
j.v = m
j.q = n
assert j.q.r.s.q.y.o.y.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: A = None
        self.s: B = None
        self.w: A = None
        self.txt = txt

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

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

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

i = A("i")
a = B("a")
b = C("b")
g = D("g")
m = C("m")
n = B("n")
k = C("k")
c = A("c")
j = D("j")

i.r = c
i.z = c
i.w = c
i.s = a
a.r = b
a.y = k
b.o = n
b.p = j
b.y = k
b.s = g
g.v = k
g.q = n
m.o = n
m.p = j
m.s = j
m.y = b
n.r = m
n.y = k
k.o = a
k.p = j
k.s = j
k.y = b
c.r = i
c.z = i
c.w = i
c.s = n
j.v = m
j.q = n
assert j.q.r.s.q.y.o.y.s.q.txt == "n"