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

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

class C:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: E = None
        self.p: F = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: F = None
        self.y: F = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: E = None
        self.p: F = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: F = None
        self.y: F = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

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