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

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

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

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

g = A("g")
n = B("n")
e = C("e")
i = D("i")
c = A("c")
l = A("l")
a = C("a")
d = A("d")
j = D("j")

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

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

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

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

g = A("g")
n = B("n")
e = C("e")
i = D("i")
c = A("c")
l = A("l")
a = C("a")
d = A("d")
j = D("j")

g.p = j
g.y = j
g.u = e
g.r = i
n.p = i
e.s = c
e.y = n
e.v = a
i.r = e
i.s = j
i.z = l
i.w = n
c.p = j
c.r = j
c.y = i
c.u = e
l.p = j
l.y = i
l.r = i
l.u = e
a.s = c
a.y = n
a.v = e
d.p = j
d.y = j
d.u = a
d.r = i
j.r = e
j.s = i
j.z = g
j.w = n
assert j.s.w.p.w.p.s.r.txt == "e"