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

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

class C:
    def __init__(self, txt: str):
        self.r: A = 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.o: E = None
        self.x: D = None
        self.v: D = None
        self.w: E = None
        self.txt = txt

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

e.p = h
k.u = g
b.r = g
j.u = b
f.o = c
f.w = c
f.x = i
f.v = i
h.p = g
g.p = e
n.u = e
i.u = b
c.o = f
c.w = f
c.x = i
c.v = j
assert h.p.p.p.p.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = 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.o: E = None
        self.x: D = None
        self.v: D = None
        self.w: E = None
        self.txt = txt

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

e.p = h
k.u = g
b.r = g
j.u = b
f.o = c
f.w = c
f.x = i
f.v = i
h.p = g
g.p = e
n.u = e
i.u = b
c.o = f
c.w = f
c.x = i
c.v = j
assert h.p.p.p.p.p.p.p.p.p.p.txt == "g"