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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: E = None
        self.x: D = None
        self.v: E = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: E = None
        self.x: D = None
        self.v: E = None
        self.r: F = None
        self.txt = txt

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

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

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

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