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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: F = None
        self.q: E = None
        self.u: A = None
        self.o: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: C = None
        self.o: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.s: E = None
        self.q: D = None
        self.x: D = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

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

f.v = g
f.x = g
f.s = h
h.y = i
l.p = f
l.u = f
l.s = g
l.q = e
l.o = h
a.q = g
a.x = h
e.s = l
e.z = l
g.v = a
g.o = a
g.x = l
i.z = e
i.s = e
i.q = a
i.x = a
i.r = f
i.u = f
assert l.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: F = None
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: F = None
        self.q: E = None
        self.u: A = None
        self.o: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: C = None
        self.o: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.s: E = None
        self.q: D = None
        self.x: D = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

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

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