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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: F = None
        self.x: D = None
        self.y: C = None
        self.z: E = None
        self.p: B = None
        self.txt = txt

j = A("j")
f = B("f")
g = C("g")
i = D("i")
c = E("c")
m = F("m")
e = G("e")

j.p = g
j.o = i
f.o = g
f.p = j
g.u = e
g.x = e
i.v = e
i.z = f
i.t = f
i.o = j
c.u = i
c.t = i
c.s = j
m.x = c
e.w = m
e.s = m
e.x = i
e.y = g
e.z = c
e.p = f
assert m.x.u.o.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: F = None
        self.x: D = None
        self.y: C = None
        self.z: E = None
        self.p: B = None
        self.txt = txt

j = A("j")
f = B("f")
g = C("g")
i = D("i")
c = E("c")
m = F("m")
e = G("e")

j.p = g
j.o = i
f.o = g
f.p = j
g.u = e
g.x = e
i.v = e
i.z = f
i.t = f
i.o = j
c.u = i
c.t = i
c.s = j
m.x = c
e.w = m
e.s = m
e.x = i
e.y = g
e.z = c
e.p = f
assert m.x.u.o.o.v.txt == "e"