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

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

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

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

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

n = A("n")
f = B("f")
b = C("b")
m = D("m")
g = E("g")
d = D("d")
e = D("e")
l = E("l")
i = C("i")
j = C("j")

n.r = i
f.v = n
f.o = i
b.r = m
b.w = n
m.t = l
g.v = m
g.z = l
g.w = l
g.p = l
d.t = l
e.t = g
l.v = e
l.z = g
l.w = g
l.p = g
i.r = m
i.w = n
j.r = e
j.w = n
assert b.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

n = A("n")
f = B("f")
b = C("b")
m = D("m")
g = E("g")
d = D("d")
e = D("e")
l = E("l")
i = C("i")
j = C("j")

n.r = i
f.v = n
f.o = i
b.r = m
b.w = n
m.t = l
g.v = m
g.z = l
g.w = l
g.p = l
d.t = l
e.t = g
l.v = e
l.z = g
l.w = g
l.p = g
i.r = m
i.w = n
j.r = e
j.w = n
assert b.r.t.w.txt == "g"