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

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

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

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

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

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

b.t = d
b.r = g
g.w = b
g.v = j
n.q = b
n.p = g
n.y = g
a.t = b
j.s = n
j.r = i
j.v = d
h.t = b
f.t = i
d.t = i
c.t = i
i.t = d
i.r = g
assert g.v.r.t.t.t.t.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

b.t = d
b.r = g
g.w = b
g.v = j
n.q = b
n.p = g
n.y = g
a.t = b
j.s = n
j.r = i
j.v = d
h.t = b
f.t = i
d.t = i
c.t = i
i.t = d
i.r = g
assert g.v.r.t.t.t.t.r.w.r.txt == "g"