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

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

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

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

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

h = A("h")
f = B("f")
e = C("e")
b = D("b")
g = E("g")
l = C("l")
d = A("d")
a = E("a")

h.v = d
h.t = d
h.q = b
f.r = e
f.t = e
f.p = h
f.u = h
f.x = b
e.r = l
e.x = l
e.t = h
e.v = d
e.q = b
b.v = a
g.u = a
g.v = b
l.r = e
l.x = e
l.t = h
l.v = h
l.q = b
d.v = h
d.t = h
d.q = b
a.u = g
a.v = b
assert a.u.v.v.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: A = None
        self.q: D = None
        self.txt = txt

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

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

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

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

h = A("h")
f = B("f")
e = C("e")
b = D("b")
g = E("g")
l = C("l")
d = A("d")
a = E("a")

h.v = d
h.t = d
h.q = b
f.r = e
f.t = e
f.p = h
f.u = h
f.x = b
e.r = l
e.x = l
e.t = h
e.v = d
e.q = b
b.v = a
g.u = a
g.v = b
l.r = e
l.x = e
l.t = h
l.v = h
l.q = b
d.v = h
d.t = h
d.q = b
a.u = g
a.v = b
assert a.u.v.v.u.u.u.txt == "g"