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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.w: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.w: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

f.u = d
f.t = d
f.x = d
g.q = a
g.r = a
g.w = h
g.y = d
a.p = f
d.t = f
d.q = f
d.o = e
d.s = g
d.u = h
h.x = g
h.r = a
h.t = a
e.q = a
e.r = a
e.w = h
e.y = d
assert d.o.y.q.t.txt == "d"