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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: C = None
        self.v: E = None
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.u: C = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.q: A = None
        self.u: G = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: C = None
        self.v: E = None
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.u: C = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.q: A = None
        self.u: G = None
        self.txt = txt

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

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

g.x = f
g.o = f
g.v = f
g.p = c
f.z = g
f.u = e
f.v = i
f.w = l
e.r = c
e.q = k
l.t = i
l.s = f
l.u = e
l.r = e
i.w = e
c.p = i
c.x = i
c.q = g
c.u = k
k.t = f
k.y = f
k.z = g
assert l.s.z.p.x.w.r.q.txt == "g"