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

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

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

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

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

a = A("a")
g = B("g")
j = C("j")
f = D("f")
d = E("d")
k = B("k")

a.y = d
a.w = d
a.u = g
a.x = k
a.t = j
g.s = f
g.u = f
g.p = d
g.w = a
j.w = a
f.r = k
d.t = a
k.s = f
k.u = f
k.p = d
k.w = a
assert k.u.r.w.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: B = None
        self.x: B = None
        self.w: E = None
        self.t: C = None
        self.txt = txt

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

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

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

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

a = A("a")
g = B("g")
j = C("j")
f = D("f")
d = E("d")
k = B("k")

a.y = d
a.w = d
a.u = g
a.x = k
a.t = j
g.s = f
g.u = f
g.p = d
g.w = a
j.w = a
f.r = k
d.t = a
k.s = f
k.u = f
k.p = d
k.w = a
assert k.u.r.w.t.w.t.txt == "j"