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

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

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

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

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

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

k.y = a
n.z = f
n.t = a
a.q = k
a.t = n
a.y = f
j.q = n
f.z = a
f.o = n
assert k.y.t.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

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

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

k.y = a
n.z = f
n.t = a
a.q = k
a.t = n
a.y = f
j.q = n
f.z = a
f.o = n
assert k.y.t.t.q.y.txt == "a"