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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

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

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

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

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

l = A("l")
i = B("i")
k = C("k")
d = D("d")
j = E("j")
h = F("h")
f = G("f")
g = H("g")

l.v = d
i.r = h
k.z = h
d.r = g
j.z = h
j.r = g
h.o = i
h.t = i
h.y = i
h.w = k
h.s = f
h.x = g
h.q = j
f.o = h
f.z = j
f.v = i
g.q = f
g.x = k
assert g.q.v.r.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

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

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

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

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

l = A("l")
i = B("i")
k = C("k")
d = D("d")
j = E("j")
h = F("h")
f = G("f")
g = H("g")

l.v = d
i.r = h
k.z = h
d.r = g
j.z = h
j.r = g
h.o = i
h.t = i
h.y = i
h.w = k
h.s = f
h.x = g
h.q = j
f.o = h
f.z = j
f.v = i
g.q = f
g.x = k
assert g.q.v.r.x.x.txt == "k"