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

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

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

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

e = A("e")
k = B("k")
n = C("n")
a = D("a")
l = B("l")
c = D("c")
d = B("d")
h = B("h")
j = D("j")
b = A("b")

e.x = j
e.r = c
e.q = c
e.y = d
k.z = j
k.r = j
k.w = h
k.v = n
n.p = d
a.r = j
a.p = j
a.y = n
l.z = a
l.w = k
l.v = n
l.r = j
c.r = a
c.p = a
c.y = n
d.z = a
d.r = a
d.w = h
d.v = n
h.z = c
h.r = c
h.w = d
h.v = n
j.r = a
j.y = n
j.p = c
b.x = a
b.r = j
b.q = j
b.y = d
assert j.r.y.p.v.p.w.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: D = None
        self.y: B = None
        self.q: D = None
        self.txt = txt

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

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

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

e = A("e")
k = B("k")
n = C("n")
a = D("a")
l = B("l")
c = D("c")
d = B("d")
h = B("h")
j = D("j")
b = A("b")

e.x = j
e.r = c
e.q = c
e.y = d
k.z = j
k.r = j
k.w = h
k.v = n
n.p = d
a.r = j
a.p = j
a.y = n
l.z = a
l.w = k
l.v = n
l.r = j
c.r = a
c.p = a
c.y = n
d.z = a
d.r = a
d.w = h
d.v = n
h.z = c
h.r = c
h.w = d
h.v = n
j.r = a
j.y = n
j.p = c
b.x = a
b.r = j
b.q = j
b.y = d
assert j.r.y.p.v.p.w.v.p.txt == "d"