class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: B = None
        self.q: B = None
        self.z: D = None
        self.r: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: F = None
        self.r: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: F = None
        self.r: D = None
        self.s: B = None
        self.txt = txt

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

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

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

a.v = c
a.x = n
a.q = n
a.z = f
a.r = f
n.z = j
i.v = g
f.s = i
f.o = g
f.r = j
g.y = c
g.x = c
g.r = f
g.s = n
c.t = n
c.s = n
j.x = n
j.o = i
assert j.x.z.o.v.s.z.x.txt == "n"