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

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

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

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

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

c = A("c")
d = B("d")
e = C("e")
l = D("l")
k = E("k")
h = A("h")
b = B("b")
m = B("m")

c.v = d
d.w = e
e.w = b
l.x = k
l.p = b
l.q = e
l.w = e
k.u = e
k.w = e
k.x = d
h.v = m
b.w = e
m.w = e
assert e.w.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

c = A("c")
d = B("d")
e = C("e")
l = D("l")
k = E("k")
h = A("h")
b = B("b")
m = B("m")

c.v = d
d.w = e
e.w = b
l.x = k
l.p = b
l.q = e
l.w = e
k.u = e
k.w = e
k.x = d
h.v = m
b.w = e
m.w = e
assert e.w.w.w.w.w.w.w.txt == "b"