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

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

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

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

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

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

f.q = n
e.z = k
e.t = k
e.u = f
e.x = f
e.q = n
k.z = d
k.o = f
k.v = j
d.z = n
n.t = d
n.s = f
n.r = f
j.z = k
j.t = k
j.u = f
j.x = f
j.q = n
assert e.q.r.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

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

f.q = n
e.z = k
e.t = k
e.u = f
e.x = f
e.q = n
k.z = d
k.o = f
k.v = j
d.z = n
n.t = d
n.s = f
n.r = f
j.z = k
j.t = k
j.u = f
j.x = f
j.q = n
assert e.q.r.q.t.txt == "d"