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

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.t: F = None
        self.q: F = None
        self.y: C = None
        self.x: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: F = None
        self.x: D = None
        self.t: A = None
        self.u: B = None
        self.y: F = None
        self.txt = txt

a = A("a")
j = B("j")
h = C("h")
n = D("n")
b = E("b")
m = F("m")
i = G("i")
l = E("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.t: F = None
        self.q: F = None
        self.y: C = None
        self.x: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: F = None
        self.x: D = None
        self.t: A = None
        self.u: B = None
        self.y: F = None
        self.txt = txt

a = A("a")
j = B("j")
h = C("h")
n = D("n")
b = E("b")
m = F("m")
i = G("i")
l = E("l")

a.z = j
a.o = m
j.r = n
h.r = m
h.p = j
h.s = a
h.w = i
n.z = i
n.t = m
n.q = m
n.y = h
n.x = b
b.v = m
b.w = a
m.p = j
m.u = j
m.r = b
m.z = h
m.o = i
m.s = n
i.p = j
i.u = j
i.w = m
i.y = m
i.x = n
i.t = a
l.v = m
l.w = a
assert a.o.p.r.y.p.txt == "j"