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

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

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

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

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

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

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

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

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

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

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

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

a.u = l
h.x = k
h.w = k
h.v = k
h.q = k
h.r = c
k.t = l
g.q = c
g.x = h
g.w = d
g.o = a
l.z = k
l.y = k
l.t = g
d.u = l
c.x = k
c.w = k
c.v = k
c.q = k
c.r = h
assert l.z.t.y.t.t.x.txt == "h"