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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: C = None
        self.u: C = None
        self.p: G = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: C = None
        self.u: C = None
        self.p: G = None
        self.x: G = None
        self.txt = txt

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

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

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