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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

e = A("e")
a = B("a")
g = C("g")
m = D("m")
d = E("d")
f = B("f")
i = C("i")
n = C("n")
j = A("j")
h = C("h")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

e = A("e")
a = B("a")
g = C("g")
m = D("m")
d = E("d")
f = B("f")
i = C("i")
n = C("n")
j = A("j")
h = C("h")

e.v = a
a.q = g
a.r = f
a.o = e
g.z = d
g.q = d
g.r = d
m.z = h
d.u = e
d.r = h
d.p = n
f.q = n
f.r = a
f.o = j
i.z = d
i.q = d
i.r = d
n.z = d
n.q = d
n.r = d
j.v = f
h.z = d
h.q = d
h.r = d
assert e.v.q.z.p.txt == "n"