class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

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

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

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

f.y = j
f.s = l
k.o = f
k.x = n
k.p = n
a.z = e
g.s = k
g.y = n
g.r = e
e.y = j
e.w = g
e.t = f
l.o = f
l.x = k
l.p = k
n.o = f
n.x = l
n.p = k
j.y = e
j.w = g
j.t = f
assert g.s.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

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

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

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

f.y = j
f.s = l
k.o = f
k.x = n
k.p = n
a.z = e
g.s = k
g.y = n
g.r = e
e.y = j
e.w = g
e.t = f
l.o = f
l.x = k
l.p = k
n.o = f
n.x = l
n.p = k
j.y = e
j.w = g
j.t = f
assert g.s.x.p.txt == "k"