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

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

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

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

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

l = A("l")
k = B("k")
n = C("n")
i = D("i")
g = E("g")

l.t = n
l.q = i
k.u = i
k.x = i
n.q = l
n.r = g
i.x = n
i.t = n
i.q = k
i.w = g
g.v = l
g.y = n
g.s = n
g.q = k
assert g.y.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
n = C("n")
i = D("i")
g = E("g")

l.t = n
l.q = i
k.u = i
k.x = i
n.q = l
n.r = g
i.x = n
i.t = n
i.q = k
i.w = g
g.v = l
g.y = n
g.s = n
g.q = k
assert g.y.q.q.txt == "i"