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

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

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

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

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

l = A("l")
a = B("a")
f = C("f")
c = D("c")
e = E("e")
m = D("m")
k = C("k")

l.p = a
l.y = a
l.r = m
a.p = m
a.z = k
a.u = e
a.w = e
f.z = e
f.y = e
f.w = m
f.r = k
f.u = a
c.y = m
e.w = c
e.v = l
m.y = c
k.z = e
k.y = e
k.w = c
k.r = f
k.u = a
assert e.v.r.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

l = A("l")
a = B("a")
f = C("f")
c = D("c")
e = E("e")
m = D("m")
k = C("k")

l.p = a
l.y = a
l.r = m
a.p = m
a.z = k
a.u = e
a.w = e
f.z = e
f.y = e
f.w = m
f.r = k
f.u = a
c.y = m
e.w = c
e.v = l
m.y = c
k.z = e
k.y = e
k.w = c
k.r = f
k.u = a
assert e.v.r.y.y.y.y.y.txt == "c"