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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: E = None
        self.r: F = None
        self.u: C = None
        self.x: A = None
        self.w: D = None
        self.v: D = None
        self.txt = txt

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

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

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

e = A("e")
b = B("b")
n = C("n")
j = D("j")
m = E("m")
g = F("g")
k = G("k")
d = B("d")
f = F("f")
a = D("a")

e.x = g
e.v = n
e.p = b
b.r = g
n.q = m
n.o = a
j.q = b
j.p = m
j.r = g
j.u = n
j.x = e
j.w = a
j.v = a
m.z = j
g.r = j
g.o = k
g.z = m
g.v = m
g.w = e
g.q = n
k.o = g
d.r = f
f.r = a
f.o = k
f.z = m
f.v = m
f.w = e
f.q = n
a.q = b
a.p = m
a.r = f
a.u = n
a.x = e
a.w = j
a.v = j
assert j.p.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: C = None
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: E = None
        self.r: F = None
        self.u: C = None
        self.x: A = None
        self.w: D = None
        self.v: D = None
        self.txt = txt

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

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

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

e = A("e")
b = B("b")
n = C("n")
j = D("j")
m = E("m")
g = F("g")
k = G("k")
d = B("d")
f = F("f")
a = D("a")

e.x = g
e.v = n
e.p = b
b.r = g
n.q = m
n.o = a
j.q = b
j.p = m
j.r = g
j.u = n
j.x = e
j.w = a
j.v = a
m.z = j
g.r = j
g.o = k
g.z = m
g.v = m
g.w = e
g.q = n
k.o = g
d.r = f
f.r = a
f.o = k
f.z = m
f.v = m
f.w = e
f.q = n
a.q = b
a.p = m
a.r = f
a.u = n
a.x = e
a.w = j
a.v = j
assert j.p.z.p.z.txt == "j"