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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: E = None
        self.u: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: C = None
        self.txt = txt

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

a.t = j
g.q = j
g.p = a
h.s = j
h.t = j
c.q = j
c.z = j
c.u = h
c.v = a
j.x = a
j.q = h
i.q = j
i.z = j
i.u = h
i.v = a
k.q = j
k.z = j
k.u = e
k.v = a
n.q = j
n.z = j
n.u = h
n.v = a
e.s = j
e.t = j
d.q = j
d.p = a
assert g.q.x.t.q.s.x.t.x.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: E = None
        self.u: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: C = None
        self.txt = txt

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

a.t = j
g.q = j
g.p = a
h.s = j
h.t = j
c.q = j
c.z = j
c.u = h
c.v = a
j.x = a
j.q = h
i.q = j
i.z = j
i.u = h
i.v = a
k.q = j
k.z = j
k.u = e
k.v = a
n.q = j
n.z = j
n.u = h
n.v = a
e.s = j
e.t = j
d.q = j
d.p = a
assert g.q.x.t.q.s.x.t.x.t.q.txt == "h"