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

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

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

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

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

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

b.r = a
g.o = l
g.u = l
d.x = h
d.v = g
d.u = k
d.q = b
h.x = f
l.s = d
f.x = h
f.v = g
f.u = k
f.q = k
k.r = l
a.s = f
assert k.r.s.v.u.s.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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

b.r = a
g.o = l
g.u = l
d.x = h
d.v = g
d.u = k
d.q = b
h.x = f
l.s = d
f.x = h
f.v = g
f.u = k
f.q = k
k.r = l
a.s = f
assert k.r.s.v.u.s.x.x.x.txt == "h"