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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: A = None
        self.v: D = None
        self.q: A = None
        self.u: C = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
k = C("k")
g = D("g")
l = E("l")
f = B("f")
e = C("e")
n = A("n")

d.p = i
d.z = g
d.u = n
i.u = g
i.v = l
i.z = k
k.w = f
k.t = d
k.v = g
k.q = n
k.u = e
g.o = k
l.p = k
l.o = k
l.q = e
l.r = i
f.u = g
f.v = l
f.z = e
e.w = f
e.t = d
e.q = d
e.v = g
e.u = k
n.p = i
n.z = g
n.u = d
assert d.p.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: D = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: A = None
        self.v: D = None
        self.q: A = None
        self.u: C = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
k = C("k")
g = D("g")
l = E("l")
f = B("f")
e = C("e")
n = A("n")

d.p = i
d.z = g
d.u = n
i.u = g
i.v = l
i.z = k
k.w = f
k.t = d
k.v = g
k.q = n
k.u = e
g.o = k
l.p = k
l.o = k
l.q = e
l.r = i
f.u = g
f.v = l
f.z = e
e.w = f
e.t = d
e.q = d
e.v = g
e.u = k
n.p = i
n.z = g
n.u = d
assert d.p.v.p.txt == "k"