class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: B = None
        self.y: 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.q: D = None
        self.y: F = None
        self.w: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: D = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: A = None
        self.z: C = None
        self.o: B = None
        self.txt = txt

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

i.z = n
i.s = g
i.y = m
g.s = i
e.q = h
e.y = n
e.w = m
h.w = n
h.r = l
l.v = h
l.y = g
n.v = l
n.o = h
n.x = h
m.y = g
m.o = g
m.p = i
m.z = e
assert m.z.q.w.x.r.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: B = None
        self.y: 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.q: D = None
        self.y: F = None
        self.w: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: D = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: A = None
        self.z: C = None
        self.o: B = None
        self.txt = txt

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

i.z = n
i.s = g
i.y = m
g.s = i
e.q = h
e.y = n
e.w = m
h.w = n
h.r = l
l.v = h
l.y = g
n.v = l
n.o = h
n.x = h
m.y = g
m.o = g
m.p = i
m.z = e
assert m.z.q.w.x.r.y.s.txt == "i"