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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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