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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.y: D = None
        self.v: E = None
        self.txt = txt

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

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

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

h = A("h")
g = B("g")
k = C("k")
c = D("c")
i = E("i")
j = A("j")
f = A("f")
b = C("b")
d = C("d")

h.q = c
h.p = c
h.r = g
h.v = j
h.w = d
g.t = d
g.p = k
g.y = c
g.v = i
k.r = j
k.y = b
k.v = c
k.z = c
c.y = d
c.r = k
i.r = j
j.q = c
j.p = c
j.r = g
j.v = h
j.w = k
f.q = c
f.p = c
f.r = g
f.v = h
f.w = k
b.r = f
b.y = d
b.v = c
b.z = c
d.r = j
d.y = k
d.v = c
d.z = c
assert j.w.z.r.y.y.v.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: B = None
        self.v: A = None
        self.p: D = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.y: D = None
        self.v: E = None
        self.txt = txt

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

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

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

h = A("h")
g = B("g")
k = C("k")
c = D("c")
i = E("i")
j = A("j")
f = A("f")
b = C("b")
d = C("d")

h.q = c
h.p = c
h.r = g
h.v = j
h.w = d
g.t = d
g.p = k
g.y = c
g.v = i
k.r = j
k.y = b
k.v = c
k.z = c
c.y = d
c.r = k
i.r = j
j.q = c
j.p = c
j.r = g
j.v = h
j.w = k
f.q = c
f.p = c
f.r = g
f.v = h
f.w = k
b.r = f
b.y = d
b.v = c
b.z = c
d.r = j
d.y = k
d.v = c
d.z = c
assert j.w.z.r.y.y.v.r.r.r.txt == "g"