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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.z: D = None
        self.s: E = None
        self.x: B = None
        self.r: G = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.z: D = None
        self.s: E = None
        self.x: B = None
        self.r: G = None
        self.y: D = None
        self.txt = txt

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

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

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