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

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

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

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

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

f = A("f")
i = B("i")
c = C("c")
d = D("d")
n = E("n")
a = E("a")

f.q = d
i.z = d
i.s = d
c.v = i
c.x = i
d.t = f
n.v = c
n.q = c
n.t = c
n.r = a
a.v = c
a.q = c
a.t = c
a.r = n
assert n.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

f = A("f")
i = B("i")
c = C("c")
d = D("d")
n = E("n")
a = E("a")

f.q = d
i.z = d
i.s = d
c.v = i
c.x = i
d.t = f
n.v = c
n.q = c
n.t = c
n.r = a
a.v = c
a.q = c
a.t = c
a.r = n
assert n.r.r.r.r.r.r.txt == "n"