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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: D = None
        self.v: 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.p: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

f.x = a
e.p = i
e.s = i
e.v = k
k.v = e
i.p = f
n.z = e
n.s = e
n.p = e
n.o = f
a.o = e
g.t = k
assert a.o.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: D = None
        self.v: 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.p: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

f.x = a
e.p = i
e.s = i
e.v = k
k.v = e
i.p = f
n.z = e
n.s = e
n.p = e
n.o = f
a.o = e
g.t = k
assert a.o.v.v.v.txt == "k"