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

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

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

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

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

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

d.u = g
d.o = e
n.x = g
n.u = b
f.u = l
h.y = d
h.t = f
e.u = n
e.x = l
e.y = l
e.w = h
e.q = b
c.x = g
c.u = b
a.u = d
l.u = g
l.o = e
b.x = h
b.u = n
g.y = d
g.t = a
assert b.x.y.o.q.x.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

d.u = g
d.o = e
n.x = g
n.u = b
f.u = l
h.y = d
h.t = f
e.u = n
e.x = l
e.y = l
e.w = h
e.q = b
c.x = g
c.u = b
a.u = d
l.u = g
l.o = e
b.x = h
b.u = n
g.y = d
g.t = a
assert b.x.y.o.q.x.t.u.u.txt == "g"