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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: A = None
        self.txt = txt

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

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

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

j.q = k
j.s = f
a.p = k
a.y = k
a.t = j
f.t = a
f.w = j
m.r = j
m.v = f
m.p = k
k.q = j
k.o = j
k.y = m
l.r = j
l.v = f
l.p = k
assert a.y.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: A = None
        self.txt = txt

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

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

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

j.q = k
j.s = f
a.p = k
a.y = k
a.t = j
f.t = a
f.w = j
m.r = j
m.v = f
m.p = k
k.q = j
k.o = j
k.y = m
l.r = j
l.v = f
l.p = k
assert a.y.y.p.txt == "k"