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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: F = None
        self.w: A = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: C = None
        self.t: E = None
        self.u: B = None
        self.txt = txt

m = A("m")
d = B("d")
i = C("i")
f = D("f")
a = E("a")
j = F("j")
g = G("g")
l = A("l")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: F = None
        self.w: A = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: C = None
        self.t: E = None
        self.u: B = None
        self.txt = txt

m = A("m")
d = B("d")
i = C("i")
f = D("f")
a = E("a")
j = F("j")
g = G("g")
l = A("l")

m.v = f
m.p = l
d.q = m
d.u = i
d.o = f
i.x = l
i.s = f
i.p = g
f.x = d
a.v = j
a.z = j
a.w = m
a.q = g
j.o = l
j.p = a
j.y = f
g.s = m
g.o = i
g.t = a
g.u = d
l.v = f
l.p = m
assert a.w.p.p.p.v.x.txt == "d"