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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

c = A("c")
k = B("k")
h = C("h")
a = D("a")
n = E("n")

c.t = n
c.v = k
c.q = h
k.q = h
h.q = a
h.t = k
h.v = k
a.u = h
n.u = c
n.x = c
assert a.u.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: B = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

c = A("c")
k = B("k")
h = C("h")
a = D("a")
n = E("n")

c.t = n
c.v = k
c.q = h
k.q = h
h.q = a
h.t = k
h.v = k
a.u = h
n.u = c
n.x = c
assert a.u.q.u.q.txt == "a"