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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: A = None
        self.x: G = None
        self.y: F = None
        self.v: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: E = None
        self.z: B = None
        self.y: A = None
        self.s: B = None
        self.x: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: A = None
        self.x: G = None
        self.y: F = None
        self.v: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: E = None
        self.z: B = None
        self.y: A = None
        self.s: B = None
        self.x: C = None
        self.q: C = None
        self.txt = txt

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

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