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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: B = None
        self.q: E = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: E = None
        self.o: E = None
        self.w: A = None
        self.r: F = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: E = None
        self.z: A = None
        self.o: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
d = C("d")
c = D("c")
j = E("j")
k = F("k")
m = G("m")
a = C("a")
g = E("g")
n = B("n")

i.q = n
i.x = a
i.u = c
i.p = d
f.t = k
f.u = n
f.q = j
f.r = c
d.z = i
c.s = k
c.r = k
c.t = g
c.o = j
c.w = i
c.v = d
c.q = d
j.v = g
k.t = n
k.y = g
k.z = i
k.o = i
m.r = i
m.p = i
m.y = f
m.t = k
m.s = k
m.o = d
a.z = i
g.v = j
n.t = k
n.u = f
n.q = g
n.r = c
assert f.q.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: C = None
        self.u: D = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: B = None
        self.q: E = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: E = None
        self.o: E = None
        self.w: A = None
        self.r: F = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: E = None
        self.z: A = None
        self.o: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
d = C("d")
c = D("c")
j = E("j")
k = F("k")
m = G("m")
a = C("a")
g = E("g")
n = B("n")

i.q = n
i.x = a
i.u = c
i.p = d
f.t = k
f.u = n
f.q = j
f.r = c
d.z = i
c.s = k
c.r = k
c.t = g
c.o = j
c.w = i
c.v = d
c.q = d
j.v = g
k.t = n
k.y = g
k.z = i
k.o = i
m.r = i
m.p = i
m.y = f
m.t = k
m.s = k
m.o = d
a.z = i
g.v = j
n.t = k
n.u = f
n.q = g
n.r = c
assert f.q.v.v.v.v.txt == "j"