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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.q: E = None
        self.p: B = None
        self.r: D = None
        self.txt = txt

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

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

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

n.v = d
i.w = b
e.o = h
e.q = c
e.p = b
e.r = d
d.x = a
h.t = b
h.v = i
h.q = c
h.p = a
a.v = j
b.w = i
f.o = c
f.q = c
f.p = b
f.r = d
j.x = n
c.t = b
c.v = i
c.q = h
c.p = a
assert h.q.v.w.w.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.q: E = None
        self.p: B = None
        self.r: D = None
        self.txt = txt

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

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

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

n.v = d
i.w = b
e.o = h
e.q = c
e.p = b
e.r = d
d.x = a
h.t = b
h.v = i
h.q = c
h.p = a
a.v = j
b.w = i
f.o = c
f.q = c
f.p = b
f.r = d
j.x = n
c.t = b
c.v = i
c.q = h
c.p = a
assert h.q.v.w.w.w.w.w.w.w.w.txt == "i"