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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: D = None
        self.p: C = None
        self.v: C = None
        self.txt = txt

m = A("m")
a = B("a")
b = C("b")
i = D("i")
d = E("d")
g = C("g")
f = B("f")
e = E("e")
k = B("k")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: D = None
        self.p: C = None
        self.v: C = None
        self.txt = txt

m = A("m")
a = B("a")
b = C("b")
i = D("i")
d = E("d")
g = C("g")
f = B("f")
e = E("e")
k = B("k")

m.u = f
m.x = i
a.r = i
a.x = f
a.t = d
a.y = g
b.s = k
b.q = i
i.t = d
i.u = d
i.v = b
d.o = m
d.w = i
d.p = b
d.v = g
g.s = f
g.q = i
f.r = i
f.x = k
f.t = d
f.y = g
e.o = m
e.w = i
e.p = b
e.v = g
k.r = i
k.x = f
k.t = d
k.y = b
assert k.x.t.v.q.txt == "i"