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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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