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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: A = None
        self.v: B = None
        self.x: E = None
        self.w: A = 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.t: D = None
        self.z: A = None
        self.q: C = None
        self.u: A = None
        self.p: B = None
        self.txt = txt

a = A("a")
e = B("e")
k = C("k")
f = D("f")
j = E("j")
g = A("g")
c = A("c")
d = E("d")
l = C("l")

a.p = f
a.y = c
e.y = k
e.r = l
k.r = c
k.w = c
k.y = g
k.v = e
k.x = j
f.z = k
j.t = f
j.z = a
j.u = a
j.q = k
j.p = e
g.p = f
g.y = c
c.p = f
c.y = a
d.t = f
d.z = g
d.u = g
d.q = l
d.p = e
l.r = g
l.y = a
l.w = a
l.v = e
l.x = d
assert d.u.p.z.y.p.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: A = None
        self.v: B = None
        self.x: E = None
        self.w: A = 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.t: D = None
        self.z: A = None
        self.q: C = None
        self.u: A = None
        self.p: B = None
        self.txt = txt

a = A("a")
e = B("e")
k = C("k")
f = D("f")
j = E("j")
g = A("g")
c = A("c")
d = E("d")
l = C("l")

a.p = f
a.y = c
e.y = k
e.r = l
k.r = c
k.w = c
k.y = g
k.v = e
k.x = j
f.z = k
j.t = f
j.z = a
j.u = a
j.q = k
j.p = e
g.p = f
g.y = c
c.p = f
c.y = a
d.t = f
d.z = g
d.u = g
d.q = l
d.p = e
l.r = g
l.y = a
l.w = a
l.v = e
l.x = d
assert d.u.p.z.y.p.z.y.txt == "g"