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

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: B = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: B = None
        self.q: C = None
        self.v: H = None
        self.t: H = None
        self.s: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: B = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: B = None
        self.q: C = None
        self.v: H = None
        self.t: H = None
        self.s: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = None
        self.txt = txt

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

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