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

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

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

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

n = A("n")
a = B("a")
k = C("k")
l = D("l")
h = B("h")
g = B("g")
b = D("b")
f = D("f")
d = C("d")
i = A("i")

n.y = h
a.q = i
a.w = k
a.y = n
k.w = d
k.t = d
l.u = i
l.x = h
h.q = i
h.w = d
h.y = n
g.q = i
g.w = k
g.y = n
b.u = i
b.x = g
f.u = i
f.x = h
d.w = k
d.t = k
i.y = a
assert h.w.t.t.w.t.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

n = A("n")
a = B("a")
k = C("k")
l = D("l")
h = B("h")
g = B("g")
b = D("b")
f = D("f")
d = C("d")
i = A("i")

n.y = h
a.q = i
a.w = k
a.y = n
k.w = d
k.t = d
l.u = i
l.x = h
h.q = i
h.w = d
h.y = n
g.q = i
g.w = k
g.y = n
b.u = i
b.x = g
f.u = i
f.x = h
d.w = k
d.t = k
i.y = a
assert h.w.t.t.w.t.t.w.t.txt == "k"