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

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

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

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

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

k = A("k")
a = B("a")
n = C("n")
f = D("f")
b = E("b")
d = B("d")

k.w = n
k.s = f
k.x = a
k.u = a
k.z = b
a.w = d
n.t = k
n.q = b
n.u = d
f.t = k
b.v = k
d.w = a
assert f.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: D = None
        self.x: B = None
        self.z: E = None
        self.u: B = None
        self.txt = txt

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

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

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

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

k = A("k")
a = B("a")
n = C("n")
f = D("f")
b = E("b")
d = B("d")

k.w = n
k.s = f
k.x = a
k.u = a
k.z = b
a.w = d
n.t = k
n.q = b
n.u = d
f.t = k
b.v = k
d.w = a
assert f.t.s.t.txt == "k"