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

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
d = C("d")
e = D("e")
k = E("k")
j = C("j")
i = B("i")

g.x = n
g.w = e
n.z = g
n.r = i
d.t = i
e.z = k
e.w = g
k.x = i
k.u = e
j.t = n
i.z = g
i.r = n
assert d.t.r.z.w.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
d = C("d")
e = D("e")
k = E("k")
j = C("j")
i = B("i")

g.x = n
g.w = e
n.z = g
n.r = i
d.t = i
e.z = k
e.w = g
k.x = i
k.u = e
j.t = n
i.z = g
i.r = n
assert d.t.r.z.w.w.x.txt == "n"