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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: C = None
        self.u: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: G = None
        self.w: F = None
        self.v: E = None
        self.z: C = None
        self.q: D = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: D = None
        self.s: F = None
        self.w: G = None
        self.txt = txt

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

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

g = A("g")
i = B("i")
k = C("k")
h = D("h")
j = E("j")
b = F("b")
f = G("f")
c = D("c")
e = G("e")

g.x = i
g.q = k
i.z = k
i.r = k
i.u = e
k.r = b
h.u = c
h.q = c
h.s = f
h.w = b
h.v = j
h.p = j
h.z = k
j.z = k
j.q = h
j.s = b
j.w = f
b.r = k
f.w = i
f.o = b
f.z = h
c.u = h
c.q = h
c.s = e
c.w = b
c.v = j
c.p = j
c.z = k
e.w = i
e.o = b
e.z = h
assert g.q.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: C = None
        self.u: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: G = None
        self.w: F = None
        self.v: E = None
        self.z: C = None
        self.q: D = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: D = None
        self.s: F = None
        self.w: G = None
        self.txt = txt

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

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

g = A("g")
i = B("i")
k = C("k")
h = D("h")
j = E("j")
b = F("b")
f = G("f")
c = D("c")
e = G("e")

g.x = i
g.q = k
i.z = k
i.r = k
i.u = e
k.r = b
h.u = c
h.q = c
h.s = f
h.w = b
h.v = j
h.p = j
h.z = k
j.z = k
j.q = h
j.s = b
j.w = f
b.r = k
f.w = i
f.o = b
f.z = h
c.u = h
c.q = h
c.s = e
c.w = b
c.v = j
c.p = j
c.z = k
e.w = i
e.o = b
e.z = h
assert g.q.r.r.r.r.r.r.r.r.txt == "k"