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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: D = None
        self.v: A = None
        self.q: B = None
        self.txt = txt

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

k.t = d
k.x = d
k.u = d
k.v = m
i.u = d
e.x = g
e.w = g
e.u = k
d.u = m
d.t = i
b.w = k
b.v = k
b.t = d
b.q = i
g.x = e
g.u = k
g.w = m
m.x = e
m.u = k
m.w = g
assert k.t.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: D = None
        self.v: C = None
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: D = None
        self.v: A = None
        self.q: B = None
        self.txt = txt

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

k.t = d
k.x = d
k.u = d
k.v = m
i.u = d
e.x = g
e.w = g
e.u = k
d.u = m
d.t = i
b.w = k
b.v = k
b.t = d
b.q = i
g.x = e
g.u = k
g.w = m
m.x = e
m.u = k
m.w = g
assert k.t.t.u.t.txt == "i"