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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: D = None
        self.w: A = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: D = None
        self.w: A = None
        self.r: C = None
        self.txt = txt

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

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