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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: A = None
        self.q: A = None
        self.p: D = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: A = None
        self.q: A = None
        self.p: D = None
        self.w: A = None
        self.txt = txt

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

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

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

g.w = m
g.t = m
m.q = d
m.x = i
m.v = i
m.p = e
i.x = d
i.p = d
i.v = g
i.q = g
i.w = g
d.w = g
e.v = g
e.t = g
e.p = i
e.o = d
assert d.w.w.q.w.t.txt == "m"