class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

d.t = i
d.p = i
d.w = i
n.q = a
g.t = c
g.y = n
g.q = l
g.x = i
e.v = g
e.t = g
e.z = c
c.t = i
c.w = i
c.p = e
l.t = c
l.y = n
l.q = g
l.x = i
j.t = i
j.p = i
j.w = i
a.q = n
i.v = g
i.z = c
i.t = l
assert i.t.y.q.q.q.q.q.q.q.txt == "a"