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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: E = None
        self.r: B = None
        self.q: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: D = None
        self.v: E = None
        self.t: D = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: E = None
        self.r: B = None
        self.q: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: D = None
        self.v: E = None
        self.t: D = None
        self.o: F = None
        self.txt = txt

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

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