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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: G = None
        self.x: G = None
        self.y: D = 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.y: E = None
        self.z: A = None
        self.x: F = None
        self.t: G = None
        self.p: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: G = None
        self.x: G = None
        self.y: D = 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.y: E = None
        self.z: A = None
        self.x: F = None
        self.t: G = None
        self.p: G = None
        self.txt = txt

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

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