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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: B = None
        self.o: E = None
        self.t: A = None
        self.txt = txt

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

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

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

i = A("i")
j = B("j")
a = C("a")
n = D("n")
l = E("l")
c = F("c")
g = G("g")
e = E("e")

i.r = a
i.z = g
j.r = g
j.o = g
j.x = l
j.p = a
j.q = n
a.q = c
a.y = i
n.v = i
n.t = i
n.x = j
n.o = e
l.u = g
l.p = n
l.v = n
l.q = e
l.x = j
c.o = e
c.q = a
g.t = c
e.u = g
e.p = n
e.v = n
e.q = l
e.x = j
assert a.q.q.y.r.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: B = None
        self.o: E = None
        self.t: A = None
        self.txt = txt

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

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

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

i = A("i")
j = B("j")
a = C("a")
n = D("n")
l = E("l")
c = F("c")
g = G("g")
e = E("e")

i.r = a
i.z = g
j.r = g
j.o = g
j.x = l
j.p = a
j.q = n
a.q = c
a.y = i
n.v = i
n.t = i
n.x = j
n.o = e
l.u = g
l.p = n
l.v = n
l.q = e
l.x = j
c.o = e
c.q = a
g.t = c
e.u = g
e.p = n
e.v = n
e.q = l
e.x = j
assert a.q.q.y.r.y.z.txt == "g"