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

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

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

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

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

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

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

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

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

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

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

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

m.o = f
m.x = k
k.w = e
g.p = i
g.v = d
d.x = m
i.t = m
i.v = f
i.s = e
a.w = i
n.p = i
n.v = d
f.w = e
e.t = m
e.v = f
e.s = i
assert d.x.x.w.txt == "e"