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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: E = None
        self.z: E = None
        self.y: F = None
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: F = None
        self.r: A = None
        self.p: B = None
        self.s: D = None
        self.o: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.w: G = None
        self.o: G = None
        self.x: C = None
        self.t: G = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: E = None
        self.z: E = None
        self.y: F = None
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: F = None
        self.r: A = None
        self.p: B = None
        self.s: D = None
        self.o: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.w: G = None
        self.o: G = None
        self.x: C = None
        self.t: G = None
        self.txt = txt

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

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

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