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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: A = None
        self.q: D = None
        self.s: G = None
        self.x: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: D = None
        self.q: D = None
        self.p: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: A = None
        self.q: D = None
        self.s: G = None
        self.x: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: D = None
        self.q: D = None
        self.p: E = None
        self.txt = txt

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

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

e.z = j
e.w = j
j.r = n
j.q = n
j.z = e
j.s = f
j.x = a
i.q = d
i.x = n
n.p = f
n.r = d
l.v = n
h.v = d
h.o = n
h.q = n
h.p = l
f.o = a
f.t = l
b.v = j
b.o = n
b.q = n
b.p = l
a.q = j
a.x = n
d.r = n
d.q = n
d.z = e
d.s = f
d.x = a
assert e.z.r.p.t.v.p.txt == "f"