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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.y: B = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

g = A("g")
n = B("n")
l = C("l")
k = D("k")
h = E("h")
a = B("a")

g.v = h
g.r = h
g.t = n
n.v = l
l.t = n
l.s = a
k.r = g
k.x = a
h.u = a
h.z = a
h.y = a
h.x = a
h.w = l
a.v = l
assert l.s.v.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = None
        self.t: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.y: B = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

g = A("g")
n = B("n")
l = C("l")
k = D("k")
h = E("h")
a = B("a")

g.v = h
g.r = h
g.t = n
n.v = l
l.t = n
l.s = a
k.r = g
k.x = a
h.u = a
h.z = a
h.y = a
h.x = a
h.w = l
a.v = l
assert l.s.v.s.v.s.txt == "a"