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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: D = None
        self.x: E = None
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

j.p = m
j.r = i
j.v = n
j.u = l
l.u = n
l.v = g
k.s = e
m.q = j
m.p = d
m.r = l
m.y = l
m.x = i
e.u = n
e.w = g
e.x = i
e.o = d
e.r = d
d.s = e
n.p = g
n.r = e
n.v = j
n.u = l
i.u = n
i.w = m
i.x = e
i.o = d
i.r = d
g.q = n
g.p = d
g.r = l
g.y = l
g.x = e
assert d.s.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: E = None
        self.v: A = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: D = None
        self.x: E = None
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

j.p = m
j.r = i
j.v = n
j.u = l
l.u = n
l.v = g
k.s = e
m.q = j
m.p = d
m.r = l
m.y = l
m.x = i
e.u = n
e.w = g
e.x = i
e.o = d
e.r = d
d.s = e
n.p = g
n.r = e
n.v = j
n.u = l
i.u = n
i.w = m
i.x = e
i.o = d
i.r = d
g.q = n
g.p = d
g.r = l
g.y = l
g.x = e
assert d.s.u.p.txt == "g"