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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: D = None
        self.v: B = None
        self.s: A = None
        self.z: C = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: D = None
        self.v: B = None
        self.s: A = None
        self.z: C = None
        self.w: E = None
        self.txt = txt

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

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