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

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

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

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

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

i = A("i")
c = B("c")
g = C("g")
f = D("f")
k = E("k")
h = A("h")
n = C("n")
b = E("b")

i.v = h
c.s = g
g.v = n
f.x = h
f.t = n
f.y = b
k.t = f
k.y = f
h.v = i
n.v = g
b.t = f
b.y = f
assert n.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

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

i = A("i")
c = B("c")
g = C("g")
f = D("f")
k = E("k")
h = A("h")
n = C("n")
b = E("b")

i.v = h
c.s = g
g.v = n
f.x = h
f.t = n
f.y = b
k.t = f
k.y = f
h.v = i
n.v = g
b.t = f
b.y = f
assert n.v.v.v.v.v.v.txt == "n"