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

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

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

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

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

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

g.v = j
g.r = j
g.q = m
g.p = i
g.y = b
b.w = i
j.v = g
h.v = j
h.t = g
i.y = g
i.o = b
i.t = j
m.v = j
m.t = g
a.v = j
a.t = g
assert a.t.q.v.v.p.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: D = None
        self.p: E = None
        self.r: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

g.v = j
g.r = j
g.q = m
g.p = i
g.y = b
b.w = i
j.v = g
h.v = j
h.t = g
i.y = g
i.o = b
i.t = j
m.v = j
m.t = g
a.v = j
a.t = g
assert a.t.q.v.v.p.y.r.txt == "j"