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

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

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

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

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

b = A("b")
i = B("i")
g = C("g")
j = D("j")
f = E("f")
a = D("a")

b.v = f
i.v = j
g.p = i
g.x = i
g.w = i
g.t = b
j.r = f
j.p = g
j.v = i
j.w = a
f.q = g
f.y = g
f.p = i
a.r = f
a.p = g
a.v = i
a.w = j
assert b.v.p.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

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

b = A("b")
i = B("i")
g = C("g")
j = D("j")
f = E("f")
a = D("a")

b.v = f
i.v = j
g.p = i
g.x = i
g.w = i
g.t = b
j.r = f
j.p = g
j.v = i
j.w = a
f.q = g
f.y = g
f.p = i
a.r = f
a.p = g
a.v = i
a.w = j
assert b.v.p.v.v.txt == "i"