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

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

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

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

i = A("i")
f = B("f")
g = C("g")
j = D("j")
d = D("d")
m = A("m")
e = D("e")
a = B("a")

i.w = e
i.s = a
i.v = a
f.z = j
f.w = j
f.t = g
g.w = d
j.q = g
j.u = g
j.x = a
j.t = f
d.q = g
d.u = g
d.x = a
d.t = f
m.w = j
m.s = a
m.v = a
e.q = g
e.u = g
e.x = a
e.t = f
a.z = j
a.w = e
a.t = g
assert d.t.t.w.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: B = None
        self.v: B = None
        self.txt = txt

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

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

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

i = A("i")
f = B("f")
g = C("g")
j = D("j")
d = D("d")
m = A("m")
e = D("e")
a = B("a")

i.w = e
i.s = a
i.v = a
f.z = j
f.w = j
f.t = g
g.w = d
j.q = g
j.u = g
j.x = a
j.t = f
d.q = g
d.u = g
d.x = a
d.t = f
m.w = j
m.s = a
m.v = a
e.q = g
e.u = g
e.x = a
e.t = f
a.z = j
a.w = e
a.t = g
assert d.t.t.w.x.t.txt == "g"