class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: A = None
        self.r: D = None
        self.u: A = None
        self.v: C = None
        self.txt = txt

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

h.y = e
h.p = k
h.r = g
h.x = c
g.v = i
i.x = b
i.y = g
c.t = k
e.x = k
e.r = k
e.s = b
e.u = b
e.v = i
b.y = e
b.p = c
b.x = c
b.r = g
k.t = c
assert h.p.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: A = None
        self.r: D = None
        self.u: A = None
        self.v: C = None
        self.txt = txt

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

h.y = e
h.p = k
h.r = g
h.x = c
g.v = i
i.x = b
i.y = g
c.t = k
e.x = k
e.r = k
e.s = b
e.u = b
e.v = i
b.y = e
b.p = c
b.x = c
b.r = g
k.t = c
assert h.p.t.t.t.t.t.t.txt == "k"