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

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

class C:
    def __init__(self, txt: str):
        self.o: B = 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: C = None
        self.x: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: E = None
        self.z: B = None
        self.o: E = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: C = None
        self.txt = txt

a = A("a")
i = B("i")
c = C("c")
g = D("g")
h = E("h")
m = F("m")
l = G("l")
e = A("e")
d = D("d")

a.w = l
i.s = e
c.o = i
g.r = i
h.t = c
h.x = e
m.p = e
m.s = e
m.y = h
m.o = h
m.z = i
l.x = d
l.t = c
e.w = l
d.r = i
assert i.s.w.x.r.s.w.x.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: B = 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: C = None
        self.x: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: E = None
        self.z: B = None
        self.o: E = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: C = None
        self.txt = txt

a = A("a")
i = B("i")
c = C("c")
g = D("g")
h = E("h")
m = F("m")
l = G("l")
e = A("e")
d = D("d")

a.w = l
i.s = e
c.o = i
g.r = i
h.t = c
h.x = e
m.p = e
m.s = e
m.y = h
m.o = h
m.z = i
l.x = d
l.t = c
e.w = l
d.r = i
assert i.s.w.x.r.s.w.x.r.s.txt == "e"