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

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

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

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

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

k = A("k")
j = B("j")
e = C("e")
l = D("l")
b = E("b")
a = C("a")

k.r = j
j.t = b
j.s = b
j.p = e
j.y = l
j.w = k
e.v = k
e.y = k
e.p = b
l.y = e
l.v = j
l.x = j
l.p = k
b.t = e
a.v = k
a.y = k
a.p = b
assert l.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

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

k = A("k")
j = B("j")
e = C("e")
l = D("l")
b = E("b")
a = C("a")

k.r = j
j.t = b
j.s = b
j.p = e
j.y = l
j.w = k
e.v = k
e.y = k
e.p = b
l.y = e
l.v = j
l.x = j
l.p = k
b.t = e
a.v = k
a.y = k
a.p = b
assert l.x.y.x.txt == "j"