class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: D = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: G = None
        self.r: G = None
        self.u: B = None
        self.x: E = None
        self.z: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: D = None
        self.t: A = None
        self.w: C = None
        self.y: C = None
        self.o: E = None
        self.txt = txt

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

k.y = g
k.t = b
k.r = l
c.x = a
c.p = d
l.o = k
l.q = d
l.r = d
l.u = c
l.z = c
l.x = g
b.y = e
b.t = k
b.q = g
g.z = b
g.v = l
e.t = b
e.w = a
d.q = e
d.u = b
d.t = k
d.w = l
d.y = l
d.o = g
a.y = g
a.t = b
a.r = l
assert l.x.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: D = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: G = None
        self.r: G = None
        self.u: B = None
        self.x: E = None
        self.z: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: D = None
        self.t: A = None
        self.w: C = None
        self.y: C = None
        self.o: E = None
        self.txt = txt

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

k.y = g
k.t = b
k.r = l
c.x = a
c.p = d
l.o = k
l.q = d
l.r = d
l.u = c
l.z = c
l.x = g
b.y = e
b.t = k
b.q = g
g.z = b
g.v = l
e.t = b
e.w = a
d.q = e
d.u = b
d.t = k
d.w = l
d.y = l
d.o = g
a.y = g
a.t = b
a.r = l
assert l.x.v.x.txt == "g"